Tcl, aka Tool Command Language, is a programming language created in 1988 by John Ousterhout.
#53on PLDB | 35Years Old | 3.1kUsers |
26Books | 2Papers | 14kRepos |
Tcl (pronounced "tickle" or tee cee ell, ) is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful. Tcl casts everything into the mold of a command, even programming constructs like variable assignment and procedure definition. Read more on Wikipedia...
puts {Hello, world!}
puts "Hello World"
#!/usr/local/bin/tclsh
# Hello World in Tcl
puts "Hello World!"
# XDG Base Directory Specification handling
#
# Copyright (C) 2013 Lawrence Woodman
#
# Licensed under an MIT licence. Please see LICENCE.md for details.
#
# For XDG Base Directory Specification
# http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
#
package require Tcl 8.5
namespace eval XDG {
variable DEFAULTS ""
namespace export DATA_HOME CONFIG_HOME CACHE_HOME
namespace export RUNTIME_DIR DATA_DIRS CONFIG_DIRS
}
proc XDG::SetDefaults {} {
variable DEFAULTS
if {$DEFAULTS ne ""} return
set DEFAULTS [list \
DATA_HOME [file join $::env(HOME) .local share] \
CONFIG_HOME [file join $::env(HOME) .config] \
CACHE_HOME [file join $::env(HOME) .cache] \
DATA_DIRS [list [file join /usr local share] [file join /usr share]] \
CONFIG_DIRS [list [file join /etc xdg ]]
]
}
proc XDG::XDGVarSet {var} {
expr {[info exists ::env(XDG_$var)] && $::env(XDG_$var) ne ""}
}
proc XDG::Dir {var {subdir ""} } {
variable DEFAULTS
SetDefaults
set dir [dict get $DEFAULTS $var]
if {[XDGVarSet $var]} {
set dir $::env(XDG_$var)
}
return [file join $dir $subdir]
}
proc XDG::Dirs {var {subdir ""} } {
variable DEFAULTS
SetDefaults
set rawDirs [dict get $DEFAULTS $var]
if {[XDGVarSet $var]} {
set rawDirs [split $::env(XDG_$var) ":"]
}
set outDirs {}
foreach dir $rawDirs {
lappend outDirs [file join $dir $subdir]
}
return $outDirs
}
# The remaining procs reference the environmental variables XDG_
# followed by the proc name.
proc XDG::DATA_HOME {{subdir ""}} {Dir DATA_HOME $subdir}
proc XDG::CONFIG_HOME {{subdir ""}} {Dir CONFIG_HOME $subdir}
proc XDG::CACHE_HOME {{subdir ""}} {Dir CACHE_HOME $subdir}
proc XDG::RUNTIME_DIR {{subdir ""}} {
if {![XDGVarSet RUNTIME_DIR]} { return {} }
return [file join $::env(XDG_RUNTIME_DIR) $subdir]
}
# The following procs returning the directories as a list with the most
# important first.
proc XDG::DATA_DIRS {{subdir ""}} {Dirs DATA_DIRS $subdir}
proc XDG::CONFIG_DIRS {{subdir ""}} {Dirs CONFIG_DIRS $subdir}
oo::class create fruit {
method eat {} {
puts "yummy!"
}
}
oo::class create banana {
superclass fruit
constructor {} {
my variable peeled
set peeled 0
}
method peel {} {
my variable peeled
set peeled 1
puts "skin now off"
}
method edible? {} {
my variable peeled
return $peeled
}
method eat {} {
if {![my edible?]} {
my peel
}
next
}
}
set b [banana new]
$b eat → prints "skin now off" and "yummy!"
fruit destroy
$b eat → error "unknown command"
Feature | Supported | Token | Example |
---|---|---|---|
Strings | ✓ | " | "Hello world" |
Print() Debugging | ✓ | puts | |
Line Comments | ✓ | # | # A comment |
Comments | ✓ | ||
Case Insensitive Identifiers | X | ||
Semantic Indentation | X | ||
MultiLine Comments | X |
title | author | year | reviews | ratings | rating |
---|---|---|---|---|---|
Practical Programming in TCL & TK | Brent B. Welch | 1961 | 2 | 55 | 3.87 |
Effective Tcl/TK Programming: Writing Better Programs with TCL and TK | Mark Harrison | 1997 | 0 | 4 | 3.50 |
Tcl/TK Pocket Reference: Programming Tools | Paul Raines | 1998 | 0 | 9 | 3.22 |
TCL/TK Programmer's Reference | Chris Nelson | 1999 | 1 | 1 | 5.00 |
Tcl/Tk 8.5 Programming Cookbook | Bert Wheeler | 2011 | 0 | 1 | 3.00 |
Tcl/TK Programming for the Absolute Beginner | Kurt Wall | 2007 | 1 | 1 | 4.00 |
TCL 8.5 Network Programming | Wojciech Kocjan | 2010 | 1 | 3 | 3.67 |
Tcl/TK: A Developer's Guide | Clif Flynt | 2003 | 0 | 0 | 0.0 |
TCL/TK for Dummies? | Tim Webster | 1997 | 0 | 2 | 3.50 |
CGI Programming with TCL [With CDROM] | David Maggiano | 1999 | 0 | 0 | 0.0 |
title | authors | year | publisher |
---|---|---|---|
Effective Tcl/TK Programming: Writing Better Programs with TCL and TK | Harrison, Mark and McLennan, Michael | 1997 | Addison-Wesley Professional |
Tcl and the Tk Toolkit | Ousterhout, John and Jones, Ken | 2009 | Addison-Wesley Professional |
Tcl 8.5 Network Programming (Community Experience Distilled) | Kocjan, Wojciech and Beltowski, Piotr | 2010 | Packt Publishing |
Cgi Developer's Resource: Web Programming in Tcl and Perl (Resource Series) | Ivler, J. M. and Husain, Kamran | 1997 | Prentice Hall Ptr |
Web TCL Complete | Stephen Ball | 1999 | McGraw-Hill Inc.,US |
Practical Programming in Tcl and Tk | Welch, Brent and Jones, Ken | 2003 | Pearson |
The Tcl Programming Language: A Comprehensive Guide | Nadkarni, Ashok P. | 2017 | CreateSpace Independent Publishing Platform |
Practical Programming in Tcl & Tk | Welch, Brent B. | 1997 | Prentice Hall |
TCL / TK in a Nutshell: A Desktop Quick Reference | Raines, Paul and Tranter, Jeff | 1999 | O'Reilly Media |
Tcl and Tk Programming for the Absolute Beginner | Wall, Kurt | 2007 | Cengage Learning PTR |
Tcl and the Tk Toolkit | Ousterhout, John K. | 1994 | Addison-Wesley Professional |
Practical Programming in Tcl and Tk (3rd Edition) | Welch, Brent B. | 1999 | Prentice Hall |
Practical Programming in Tcl and Tk/Book and Disk | Welch, Brent B. | 1995-04T | Prentice Hall |
Cgi Programming With Tcl | David Maggiano | 1999 | Addison-wesley |
Tcl 8.5 Network Programming | Wojciech Kocjan; Piotr Beltowski | 20100701 | Packt Publishing |
Tcl And The Tk Toolkit | Ousterhout, John K. | 1994 | Addison-wesley |
title | authors | year | citations | influentialCitations |
---|---|---|---|---|
VIPERS: a data flow visual programming environment based on the Tcl language | Massimo Bernini and M. Mosconi | 1994 | 21 | 3 |
Petascale Tcl with NAMD, VMD, and Swift/T | James C. Phillips and J. Stone and Kirby L. Vandivort and Timothy G. Armstrong and J. Wozniak and M. Wilde and K. Schulten | 2014 | 18 | 0 |