Category talk:Tcl: Difference between revisions

 
(5 intermediate revisions by 3 users not shown)
Line 1:
'''Temporary:''' Just so this is easy to find for now. [[Reports:Tasks not implemented in Tcl]]
==Tasks Unlikely to get Implemented==
This is a short discussion of the tasks that are marked with the omit template. —[[User:Dkf|Dkf]] 09:14, 21 May 2009 (UTC)
 
; [[Parametric Polymorphism]]
[[BNF Grammar]]
: Tcl's got a grammar, but it only works at the level of the base language syntax, and that's just not a level that Tclers think about that much. (For example, it doesn't tell you anything about <code>while</code>, let alone that it has an embedded block of code.) It is also about as difficult to write down as reimplementing the Tcl parser in another language.
[[Constrained Genericity]]
: This is a specialization of the Parametric Polymorphism task, so all comments there apply here too.
[[Evens Sum To Even]]
: Need the concept of proof in the language for this, and this is really an area that Tcl doesn't address. The formal way to fix it is to write a theorem prover in Tcl, but that'd be a ridiculous amount of work.
[[Parametric Polymorphism]]
: Tcl doesn't have static typing, making this task ridiculously trivial/non-applicable. Note also that the task itself states that it only applies to languages with static typing.
; [[Constrained Genericity]]
: This is a specialization of the Parametric Polymorphism task, so all comments there apply here too.
 
== Language features ==
Line 17 ⟶ 14:
I've selected these features:
 
;<tt>exec=bytecode</tt>
<code>expression=dynamic</code>
:Tcl's used a bytecode engine (with occasional interpretation) since 8.0, i.e., 1996.
:: OK, we've been discussing compiling to native code for a while now, but we've not got the effort to make that viable across lots of platforms, and going to a common bytecode format like JVM, CIL or LLVM is awkward as they are much more low-level than Tcl; for example, Tcl's variables aren't just simple bits of memory but also have a lot of other things that can be attached off them. —[[User:Dkf|Donal Fellows]] 08:23, 6 August 2009 (UTC)
;<codett>expression=dynamic</codett>
:We use dynamic typing in <code>expr</code>.
;<codett>compat=duck</codett>
:We say it's a <s>duck</s>list if it supports the operations of a <s>duck</s>list.
;<codett>checking=dynamic</codett>
:Our type checks are applied at runtime only. That's when they are enforced strictly.
;<codett>parampass=value</codett>
:We always pass parameters by value. We simulate pass-by-reference by passing handles/names and pass-by-name with the help of <code>upvar</code>.
;<codett>safety=safe</codett>
:The language, especially in a safe interpreter, has no unsafe operations at all.
;<codett>paradigms=Imperative, Object-oriented, Event-driven, Reflective, Concurrent</codett>
:Tcl supports all of these handily enough. With more detail/justification:
:;<codett>Concurrent</codett>
::The Thread extension is long-established.
:;<codett>Event-driven</codett>
::While [[Tk]] has always been event driven, Tcl has been since 7.5 or 7.6 when it gained the event loop from Tk.
:;<codett>Imperative</codett>
::Tcl is definitely an imperative language.
:;<codett>OO</codett>
::Tcl supports this through many extensions, and natively from 8.6.
:;<codett>Reflective</codett>
::Tcl's had introspection for ages; it's vital for the language's self-tests.
 
We need to check whether these features are enough; if not, we should update the Language template... —[[User:Dkf|Donal Fellows]] 12:26, 1 June 2009 (UTC)
 
=== How to use? ===
What is the correct command to start the examples? I tried 'tclsh' or 'wish', like
$ tclsh <fileWithTheCode>'
but didn't succeed for many of the examples. I use version 8.4 under Debian Squeeze, and I'm aware that all those examples that need a higher version of Tcl won't run. But if I try, for example, the "GUI component interaction" task, I get
invalid command name "ttk::frame"
while executing
"ttk::frame .bg"
If I try "Extend your language", I get
missing close-bracket
while compiling
"set c1 [uplevel 1 [list expr $cond1]
What am I doing wrong? Is 'tclsh' the right command? --[[User:Abu|Abu]] 10:11, 27 August 2010 (UTC)
<hr>
'tclsh' is most often the right command to run the Tcl interpreter. 'wish' is Tcl+Tk (the GUI toolkit), but you can as well add
package require Tk
early in the script, which then can also be called with 'tclsh'.
 
"Extend your language" is buggy (brackets must be balanced) in
set c1 [uplevel 1 [list expr $cond1]
set c2 [uplevel 1 [list expr $cond2]
where a "]" is missing at the end of both lines. I think one should only paste tested code, and test again after editing it...
-- [[User:Suchenwi|Suchenwi]] ([[User talk:Suchenwi|talk]]) 22:34, 30 January 2021 (UTC)
Anonymous user