Category talk:Tcl: Difference between revisions
m (→Language features: forgot to sign...) |
(→Language features: Reasoning behind features.) |
||
Line 17: | Line 17: | ||
Tcl uses a mixture of pass-by-value and pass-by-reference, and is very good at simulating pass-by-name too. The base language semantics are strictly pass-by-value; this was how everything was done up to Tcl 7.6, and when combined with the fact that it was also string based, it gave the language a (deserved) reputation for being slow. In Tcl 8.0 the language implementation was switched to pass-by-reference, with the entities being semantically immutable objects (the actual code is more nuanced than that, of course); that was a major part of why Tcl sped up with that version. The pass-by-name support is through the <code>[http://www.tcl.tk/man/tcl8.6/TclCmd/upvar.htm upvar]</code> command, which allows the looking-up of a variable in one scope and aliasing it to another variable in the current scope. —[[User:Dkf|Dkf]] 10:16, 31 May 2009 (UTC) |
Tcl uses a mixture of pass-by-value and pass-by-reference, and is very good at simulating pass-by-name too. The base language semantics are strictly pass-by-value; this was how everything was done up to Tcl 7.6, and when combined with the fact that it was also string based, it gave the language a (deserved) reputation for being slow. In Tcl 8.0 the language implementation was switched to pass-by-reference, with the entities being semantically immutable objects (the actual code is more nuanced than that, of course); that was a major part of why Tcl sped up with that version. The pass-by-name support is through the <code>[http://www.tcl.tk/man/tcl8.6/TclCmd/upvar.htm upvar]</code> command, which allows the looking-up of a variable in one scope and aliasing it to another variable in the current scope. —[[User:Dkf|Dkf]] 10:16, 31 May 2009 (UTC) |
||
I've selected these features: |
|||
<code>expression=dynamic</code> |
|||
:We use dynamic typing in <code>expr</code>. |
|||
<code>compat=duck</code> |
|||
:We say it's a <s>duck</s>list if it supports the operations of a <s>duck</s>list. |
|||
<code>checking=dynamic</code> |
|||
:Our type checks are applied at runtime only. That's when they are enforced strictly. |
|||
<code>parampass=value</code> |
|||
: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>. |
|||
<code>safety=safe</code> |
|||
:The language, especially in a safe interpreter, has no unsafe operations at all. |
|||
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) |
Revision as of 12:26, 1 June 2009
Tasks Unlikely to get Implemented
This is a short discussion of the tasks that are marked with the omit template. —Dkf 09:14, 21 May 2009 (UTC)
- This is a specialization of the Parametric Polymorphism task, so all comments there apply here too.
- 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.
- It's not that we can't do this. It's that we don't. One of the good things about Tcl is exactly not having to deal with this sort of thing. It's a whole layer of stuff that we avoid. But if we were to do it, we'd be looking in terms of:
- Using
string repeat
orlrepeat
- Using SWIG or critcl to write a bridge to a C allocator
- Showing how to do the classic handle-for-structure extension scheme, as documented in JO's book (and updated for the modern age)
- Using
- 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.
Language features
Tcl uses a mixture of pass-by-value and pass-by-reference, and is very good at simulating pass-by-name too. The base language semantics are strictly pass-by-value; this was how everything was done up to Tcl 7.6, and when combined with the fact that it was also string based, it gave the language a (deserved) reputation for being slow. In Tcl 8.0 the language implementation was switched to pass-by-reference, with the entities being semantically immutable objects (the actual code is more nuanced than that, of course); that was a major part of why Tcl sped up with that version. The pass-by-name support is through the upvar
command, which allows the looking-up of a variable in one scope and aliasing it to another variable in the current scope. —Dkf 10:16, 31 May 2009 (UTC)
I've selected these features:
expression=dynamic
- We use dynamic typing in
expr
.
compat=duck
- We say it's a
ducklist if it supports the operations of aducklist.
checking=dynamic
- Our type checks are applied at runtime only. That's when they are enforced strictly.
parampass=value
- We always pass parameters by value. We simulate pass-by-reference by passing handles/names and pass-by-name with the help of
upvar
.
safety=safe
- The language, especially in a safe interpreter, has no unsafe operations at all.
We need to check whether these features are enough; if not, we should update the Language template... —Donal Fellows 12:26, 1 June 2009 (UTC)