From: Neil M. <nei...@gm...> - 2011-05-23 07:35:15
|
If we propose adding := can we at least consider adding it as a statement rather than an operator? I would also prefer if it was a declaration statement rather than assignment. It could even be used to declare new functions, which might make it a bit more interesting. Apologies for top-posting. iPhone is my only email access at present. Neil On 22 May 2011, at 09:57, Alexandre Ferrieux <ale...@gm...> wrote: > On Sun, May 22, 2011 at 9:59 AM, Donal K. Fellows > <don...@ma...> wrote: >> >> Perhaps we should separate >> the debate on new RHS operators for lists and dicts from adding >> assignment (and sequencing, which only makes sense with assignment). > > Right. Changed the subject to dive into the latter. > > Regarding the fact that the assignment operator (let's call it ":=", a > grey bikeshed will suffice for now) breaks the "single interception > point" nature of [set], I beg to differ: > > First, [set] is not alone but surrounded with [lappend], [dict > lappend] etc. So, a sure-fire interception of assignment involves > exec-tracing many primitives anyway, with a terrible perf impact > (those assignments being turned from dedicated BC ops into generic > evalStk calls). > > Second, we could very well introduce [:=] as a kind of "readmacro", > ie as a preprocessing step on the AST produced by the expr parser, > replacing (the AST for) > > LHS:=RHS > > with (the AST for) > > set LHS [expr {RHS}] > > (or even [set LHS [expr {RHS}]] if we want to allow := in subexprs) > > This would have the effect of: > > - direct generation of efficient BC (storeScalar/ArrayStk) when > [set] is not redefined > > - compile-epoch bumping and traceable generation of a regular call > to [set] when it is redefined. > > -Alex > > ------------------------------------------------------------------------------ > What Every C/C++ and Fortran developer Should Know! > Read this article and learn how Intel has extended the reach of its > next-generation tools to help Windows* and Linux* C/C++ and Fortran > developers boost performance applications - including clusters. > http://p.sf.net/sfu/intel-dev2devmay > _______________________________________________ > Tcl-Core mailing list > Tcl...@li... > https://lists.sourceforge.net/lists/listinfo/tcl-core |