[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: get_local() and "(for index/limit/stop)"
- From: David Given <dg@...>
- Date: Fri, 17 Sep 2004 12:27:37 +0100
On Thursday 16 September 2004 01:28, Fabio Mascarenhas wrote:
> Depends on how you interpret the for loop. If you interpret the loop as:
Actually, I'd rather like the loop variable to be made read-only, so that the
compiler will produce an error or at least a warning if you try and modify a
loop variable. Given that the current behaviour is undefined it's not a very
useful thing to want to do anyway... and I can't count the number of times
I've had obscure bugs due to accidentally modifying a loop variable. Mostly
due to this:
for _, i in list do
_, j = somefunction()
On a slightly related note, is there any chance of getting real syntax for
discarding a return value? The convention above of using _ for unwanted
arguments is misleading; it's actually creating a variable called _. It took
a while before I realised this, hence the above code.
Does anyone actually use variables called _ for any real purpose, and if so,
+- David Given --McQ-+
| email@example.com | Uglúk u bagronk sha pushdug Internet-glob búbhosh
| (firstname.lastname@example.org) | skai.
+- www.cowlark.com --+