Live data from Hacker News

Tcl the Misunderstood (2006)

antirez.com

1–10 of 72 posts

Re: Tcl the Misunderstood (2006)

#2
I've long wished to have the free time to write a Tcl-derived language, because it really is so elegant in many ways, it just needs a bit of modernization in some areas. It's been years since I really thought much about this but I recall one of the things it's missing is closures (it does have lambdas at least).

Reading through this article, the memoize implementation does have an issue which is if the memoized command wants to call uplevel or upvar it'll get the wrong stack frame. If I were writing this I'd structure it so it's used like

  proc myMemoizingProcedure { ... } {
    memoize {
      ... the rest of the code ...
    }
  }
such that it can just `uplevel` the code. Or better yet I'd make `memoize` replace the `proc` keyword (or perhaps `memoize proc myMemoizingProcedure …`).

EDIT: I suppose memoizing makes no sense in a procedure that wants to use upvar or uplevel though, because memoizing only works for pure functions.

Re: Tcl the Misunderstood (2006)

#3
Previous discussions:

31 points|pmarin|16 years ago|17 comments

https://news.ycombinator.com/item?id=389107

181 points|zeitg3ist|12 years ago|110 comments

https://news.ycombinator.com/item?id=4920831

131 points|throwaway344|11 years ago|45 comments

https://news.ycombinator.com/item?id=7069642

182 points|goranmoomin|2 years ago|79 comments

https://news.ycombinator.com/item?id=31129936

Re: Tcl the Misunderstood (2006)

#4
This is fascinating. I have emailed Tcl's "father" (John Ousterhout) at length and he is one of the few to have actually tried to test what coding patterns make for better code and is the only book I recommend anyone when they want to get better.

Unfortunately most fall for the more popular Clean Code and it's derivatives.

Edit: The book is "A Philosophy of Software Design"

Re: Tcl the Misunderstood (2006)

#7
post #2

I've long wished to have the free time to write a Tcl-derived language, because it really is so elegant in many ways, it just needs a bit of modernization in some areas. It's been years since I really thought much about this but I recall one of the things it's missing is closures (it does have lambdas at least). Reading through this article, the memoize implementation does have an issue which is if the memoized comma…

There are these pages on the wiki regarding closures, and a reference to needing to change the internals of tcl_ObjType in order to implement them.

https://wiki.tcl-lang.org/page/Closures

https://wiki.tcl-lang.org/page/Emulating+closures+in+Tcl

TCL 9 has surely fiddled with tcl_ObjType I hope, but it doesn't seem like it from a glance.

Re: Tcl the Misunderstood (2006)

#8

This is fascinating. I have emailed Tcl's "father" (John Ousterhout) at length and he is one of the few to have actually tried to test what coding patterns make for better code and is the only book I recommend anyone when they want to get better. Unfortunately most fall for the more popular Clean Code and it's derivatives. Edit: The book is "A Philosophy of Software Design"

Which book..?

Re: Tcl the Misunderstood (2006)

#10

This is fascinating. I have emailed Tcl's "father" (John Ousterhout) at length and he is one of the few to have actually tried to test what coding patterns make for better code and is the only book I recommend anyone when they want to get better. Unfortunately most fall for the more popular Clean Code and it's derivatives. Edit: The book is "A Philosophy of Software Design"

Which book..?

My guess is 'A Philosophy of Software Design'.
Post reply on HN