[mtasc] For loop bug

Ricci Adams ricci at musictheory.net
Mon Mar 28 06:33:15 CEST 2005


 From Standard ECMA-262:

The for Statement
The production IterationStatement : for (ExpressionNoIn_opt ;  
Expression_opt ; Expression_opt ) Statement is evaluated as follows:
1. If the first Expression is not present , go to step 4.
2. Evaluate ExpressionNoIn.
3. Cal l Get Value( Result (2) ) . ( This value is not used. )
.
.

According to the standard, all three arguments of for() are declared  
optional.  Thus, Michael has a valid point and I think mtasc should  
follow the standard.

I do not believe that any neutering of architects should commence.   
Having each expression in the for() statement optional is a tradition  
that most C-base languages follow, thus, it makes sense that  
ECMAScript also follows it.

Ricci Adams

ricci at ricciadams.com
ricci at musictheory.net
AIM: RicciAdams
http://www.ricciadams.com/
http://www.musictheory.net/

On Mar 27, 2005, at 7:50 PM, Ron Wheeler wrote:

> for(; a<b; a++) is too confusing to be legal. Lets not make  
> everything legal even if MMC does.
>
> This sort of coding practice leads to madness and should be  
> punished as well as prohibited.
>
> Sorry for the rant but I have picked up too many examples of other  
> people's code that had silliness like this in it where a miniscule  
> saving in typing causes grief and heartache later.
>
> Force the programmer to put a=0 or a=1 or a=7 so that we all can  
> read the code quickly without having to refer to some reference  
> text to find out where "a" starts.
> If its legal in the ECMA standard, then I would like see if a posse  
> can be put together to find and neuter the genius who put this in  
> the standard.
>
>
>
> Ron
>
> Michael Bianco wrote:
>
>
>> Mtasc throws an error if you define a for() loop like this:
>> for(; a<b; a++)
>> it doesn't like the single colon at the beginning, MMC works fine  
>> with this.
>> --
>> MTASC : no more coffee break while compiling
>>
>>
>>
>>
>
> --
> MTASC : no more coffee break while compiling
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2430 bytes
Desc: not available
Url : http://lists.motion-twin.com/pipermail/mtasc/attachments/20050327/e39a9f80/smime-0006.bin


More information about the mtasc mailing list