www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D's string mixins are like Tcl's uplevel

reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
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
Apr 17 2018
parent Phillip <phillip ptav.ch> writes:
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.
Apr 18 2018