Re:A brief interview with Tcl creator John Ousterhout
by Scarblac on Saturday July 20, 2024 @03:04PM
(#41018841)
IIRC, the deep/shallow thing is anout how much functionality there is, and he used wide/narrow for the size of the API?
So that the goal is to have deep, narrow modules: modules that have a lot of functionality hidden behibd a small API.
Re:A brief interview with Tcl creator John Ousterhout
by v9v on Saturday July 20, 2024 @03:52PM
(#41019226)
I think a good example of this concept is the foreach command in Tcl: It's quite flexible compared to list iteration constructs found in most languages.
This is normal usage:
foreach x {1 2} {puts $x} => 1 2
You can iterate over two lists at once: foreach x {1 2} y {3 4} {puts $x $y} => 1 3 2 4
Instead of reading one element from the list, you can read multiple: foreach {x1 x2} {1 2 3 4} y {5 6} {puts $x1 $x2 $y} => 1 2 5 3 4 6
If any of the lists happen to run out before the others, instead of complaining it just returns empty elements.Many commands in Tcl give the impression that they can be used in many different ways, so writing a program in Tcl feels like building a structure by creatively assembling a limited set of legos.
Re:A brief interview with Tcl creator John Ousterhout
by runlaszlorun on Saturday July 20, 2024 @06:31PM
(#41020619)
Aha, I’d known some of the superpowers of TCL’s foreach but not all of those.
A ‘deep command’.
Shallow module - interface is relatively complex to the small functionality it provides. Shallow modules don't hide as much complexity.
https://github.com/zakirullin/cognitive-load?#too-many-small...
But I highly recommend picking up the book :) It is an enjoyable read.