Just dumping some things here that I'd like as a core language structure (and inviting others to do the same in this thread). I've often written things like this: if A+C > B then A = A+C
and wished that I could formulate it in some way that I didn't need to calculate A+C twice. Of course that could be solved in two lines: A' = A+C
if A' > B then A = A'
which is a complete solution. However, I've often wished for being able to refer to a location in a statement. (ruby-wise I'm used to putting 'if' at the end of things when convenient, but you could also write it in the oldfashioned way.): A = A+C if (righthand side of =) > B
if (lefthandside side of =) > B then A = A+C
Anyway, that's in ruby. In arc, this would translate from-to: (if (> (+ (A C)) B) (= A (+ (A C))))
(if (> (+ (A C)) B) (= A 'first))
with 'first and 'second being the (+ (A C)) and B.Would this be a useful feature? are there any other cases where being able to refer to a location in your code is a useful addition to a language? |