**Nest Programming Language** Nest is a language on top of TCL. It was originally meant to be used for a persistence package for OpenACS (http://www.openacs.org) but the time has passed. The actual code does not exceed 500 lines. Its output can be compiled into C code (or any other target language). In other words, nest provides a language to write other languages. You can find the "nest" package here: http://openacs.org/storage/download/nest-1.0.tar.bz2?file_id=4205606%|%nest-1.0%|% You may find my templating presentation in EuroTCL 2013 relevant: http://www.tcl.tk/community/tcl2013/EuroTcl/presentations/EuroTcl2013-Demetriou-WebTemplating.pdf You can follow the development here: https://github.com/neophytos-sk/nest Dependencies: * TCL (http://www.tcl.tk) * tDOM (https://tdom.github.com) History: * nest-1.0 (2014-11-30) - alias/forward, inst/decl mode, class/object aliases, struct/slot, template/pair - 322 lines Notes: * check out the definition of the struct construct in nest, I think it's cool: ====== alias {object} with_mode {inst} nest {type_helper} alias {class} with_mode {decl} nest meta {class} {class {object}} {struct} { varchar name varchar type varchar nsp varchar default_value = "" multiple struct slot = {} { varchar name varchar type varchar meta varchar default_value = "" bool optional_p = false varchar container = "" } varchar pk bool is_final_if_no_scope } ====== * also, check the pair construct, nest-style: ====== template {pair} {typefirst typesecond} { ${typefirst} {first} ${typesecond} {second} } {type_helper} ====== * check out its [lambda] proc: ====== proc lambda {params body args} { set {llength_params} [llength ${params}] set {llength_args} [llength ${args}] if { ${llength_params} - 1 <= ${llength_args} } { set {last_param} [lindex ${params} {end}] if { ${llength_params} == ${llength_args} || ${last_param} eq {args} } { unset {llength_params} {llength_args} return [uplevel 0 ${body} [if {${params} eq {}} { # llength_params == 0 and llength_args == 0 unset {last_param} {params} {body} {args} } elseif { ${last_param} ne {args} } { # llength_params == llength_args lassign ${args} {*}[concat ${params} \ [unset {last_param} {params} {body} {args}]] } else { # (llength_params - 1 <= llength_args) and last_param eq {args} set {args} [lassign ${args} {*}[lrange [concat ${params} \ [unset {last_param} {params} {body} {args}]] 0 {end-1}]] set {} {} }]] } } if { ${args} eq {} } { return [list {lambda} ${params} ${body}] } elseif {${llength_params} >= ${llength_args}} { return \ [list {lambda} [lrange ${params} ${llength_args} {end}] \ [concat \ [list lassign ${args} \ {*}[lrange ${params} 0 [expr {${llength_args} - 1}]]] { ; } ${body}]] } else { error "lambda: more args than params" } } ====== ("before the chicken and the egg, it was the nest") <>lambda | Web