From: Donal K. F. <don...@ma...> - 2011-05-26 20:20:36
|
On 17/05/2011 17:20, Brian Griffin wrote: > Assuming *all* Tcl/Tk commands that are looking for numbers call > Tcl_GetIntFromObj(interp, objPtr, intPtr) or similar, would it be > reasonable if these calls all performed an [expr objPtr]? Then one > could write: > > set val [lindex $ra {$j + 1}] > or > set val [lindex $ra {$j + $i}] > or > set val [string range $str 0 {$n / 2}] > > I would think this would be very tclish. But it would be difficult to compile the simple existing cases like: set val [lindex $ra $j] That difficulty of compilation is a symptom of the semantics being a mess. Yes, we could have done this originally (and everyone would be writing {$j} in that case) but that opportunity is long gone. Donal. |