Hacker News new | past | comments | ask | show | jobs | submit login
Tcl for Web Nerds (2011) (greenspun.com)
75 points by marttt on Oct 28, 2020 | hide | past | favorite | 13 comments



I like Tcl for its sandboxing capabilities: "Tcl added sandboxed subinterpreters in a bid to become a safe web scripting language. The plan didn't work out but it is a killer feature for untrusted input."

- https://news.ycombinator.com/item?id=23145448


It was a long time ago but TCL was the only time in my career where I had to worry about nonsense like double substitution causing arbitrary code execution or numbers being passed with a 0 prefix being handled as octal. It was a pain in the backside.


But then you switched to Javascript and all those problems melted away.


See also yesterday's discussion on the Tcl language, Why I'm Tcl-Ish: https://news.ycombinator.com/item?id=24897326


Yes, that's how I found out about Jim Tcl, an actively maintained Tcl implementation in 100-200kB:

http://jim.tcl.tk/index.html/doc/www/www/


Wow, this takes me back. My first job used OpenACS and AOLServer. We ended up converting everything to Ruby on Rails (1.16) because development had slowed so much and it was hard to find new developers, documentation, and other resources.

TCL was certainly an interesting language.


One thing that annoyed me a bit with Tcl is that tclsh doesn't come with readline support, meaning you can't go back to previous commands using the up arrow. However, you can work around that using rlwrap.

    alias tclsh=rlwrap tclsh



I wish more permissively-licensed projects used libedit instead of requiring their users to use rlwrap. It could be a simple choice for package maintainers at compile-time.


I would also highly recommend Greenspun's Software Engineering for Internet Application ("SEIA") [0] and in particular the metadata section of that book [1] wherein he goes over defining an ontology of a system, implementing a metadata model in SQL and then generating code based on that metadata model.

[0] https://philip.greenspun.com/seia/

[1] https://philip.greenspun.com/seia/metadata


For anyone not familiar with Philip Greenspun (he of Greenspun's Tenth Law fame) this is a good example of this writing and humor:

> e.g., (set! ten-factorial (factorial 10)) (set! checking-account-balance (+ 25 34 86)) (print "If you're so smart, why aren't you rich like Bill Gates?") will set ten-factorial to the result of evaluating the factorial procedure with an argument of 10, then compute a graduate student's checking account balance, then print out some career advice to a computer science graduate student.


This is pretty old, but still has some useful introductory info. Be aware that the documentation links point to Tcl 8.4 which is now obsolete, the current version is Tcl 8.6.

For a simple contemporary Tcl/web framework, take a look at Wapp - https://wapp.tcl.tk/home/doc/trunk/README.md


This is rather old:

  % factorial 145
  8047926057471991944849029257798062771099974390075006163447452810471154123736465
  2141085048187983964922743929823029891501981310822165166365957244160940855691773
  9149315905992811411866635786075524601835815642793302504243200000000000000000000
  000000000000000
  %




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: