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

lisaac-bugs at alioth.debian.org lisaac-bugs at alioth.debian.org
Thu Sep 4 10:42:56 UTC 2008


Bugs item #311017, was opened at 22/08/2008 15:04
Status: Open
Priority: 3
Submitted By: Jeremy Cowgar (jeremy-guest)
>Assigned to: Benoit Sonntag (sonntag-guest)
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: Jeremy Cowgar (jeremy-guest)
Date: 30/08/2008 19:48

Message:
I added the bug per xoswalds suggestion as he thought it was a bug as well. You know better than I do. If you feel it is not a bug, then I can close the task. I just wanted to make sure that you knew xoswald felt it was a bug as well.

It seems that:

args.count should easily access a numeric element? You can do:

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

and that will work fine. I see no real difference in the above code and;

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

It would seem funny to have to:

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


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

Comment By: Mildred Ki'Lya (mildred-guest)
Date: 30/08/2008 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