D's string mixins are like Tcl's uplevel

Phillip phillip at ptav.ch
Wed Apr 18 19:29:12 UTC 2018


On Tuesday, 17 April 2018 at 19:39:54 UTC, Ali Çehreli wrote:
> I came across this Tcl advocacy article on Reddit (the article 
> is from 2006):
>
>
> https://www.reddit.com/r/programming/comments/8cw63d/tcl_the_misunderstood/
>
> "Everything is a string" concept of Tcl reminded me of how D 
> can generate code as string. So, Tcl's 'uplevel' is like string 
> mixins. It's also similar to how body of 'static if' is 
> inserted into this context.
>
> Ali

Hmm interesting I had not thought of it that way. Since  Tcl's 
Uplevel executes a script in a different stack frame / scope to 
the current executing code in Tcl and returns the result so i 
always thought string mixin's are more of a compile time eval 
rather than Uplevel. Seeing your post and  thinking on it - i can 
see why you made the connection and both are very useful in their 
respective languages.

Since i code in both Tcl and D - nice to see a connection here.

p.





More information about the Digitalmars-d mailing list