[lisaac-Bugs][311017] args.to args.count parsing error

lisaac-bugs at alioth.debian.org lisaac-bugs at alioth.debian.org
Sat Aug 30 13:06:32 UTC 2008


Bugs item #311017, was opened at 2008-08-22 15:04
Status: Open
Priority: 3
Submitted By: Jeremy Cowgar (jeremy-guest)
Assigned to: Nobody (None)
Summary: args.to args.count parsing error 


Initial Comment:
The following code produces an error that should not be, args being an array:

args.lower.to args.count do { // code }

If you add parens around args.count, the loop parses as it should:

args.lower.to (args.count) do { // code }

Without the parens, the error message is:

Added ')'.
Line 17 column 32 in EXAMPLE(./example.li):
                                args.lower.to args.count do { i:INTEGER;
                                                            ^
--WARNING----------
Added ';'.
Line 17 column 32 in EXAMPLE(./example.li):
                                args.lower.to args.count do { i:INTEGER;
                                                            ^
--SYNTAX-----------
Incorrect symbol.
Line 17 column 32 in EXAMPLE(./example.li):
                                args.lower.to args.count do { i:INTEGER;


----------------------------------------------------------------------

>Comment By: Mildred Ki'Lya (mildred-guest)
Date: 2008-08-30 15:06

Message:
I don't think it's a bug. Perhaps the error message could be improved, but that's all.

When lisaac parses the file, it sees things like that:

((args.lower).to args).count do { // code }

There is no way for the compiler to know at parsing time whenever args is an array, have the count slot, and therefore should guess to group (args.count) together.

Think if something else:

table.fast_get "key".to_string.println;

Should it be understood as:

((table.fast_get "key").to_string).println;

or:

(table.fast_get ("key".to_string)).println;

The choise has been made long time ago, and i don't think we can change this now (this will likely break existing code).

Last thing, prefer using:

args.lower.to (args.upper)

instead of:

args.lower.to (args.count)

just a bit more clean, and you don't rely on the fact that your array start at 0. In the future, if you wan't to change your code to accept TRAVERSABLE[V] instead of FAST_ARRAY[V] it will be possible.

If you agree on what i've said, I propose that you close this bug :)

Mildred

----------------------------------------------------------------------

You can respond by visiting: 
http://alioth.debian.org/tracker/?func=detail&atid=413092&aid=311017&group_id=100200



More information about the Lisaac-devel mailing list