1. Minor bug found in 3.1 and previous

--program:
constant x=1
x=2
--end program

--error message:
C:\Euphoria\Projects\Test\test.exw:2
x has not been declared
x=2
^

Press Enter
--end message


Error message should be "May not change the value of a constant",
or something like that.


Take care,
Al

E boa sorte com sua programacao Euphoria!


My bumper sticker: "I brake for LED's"

 From "Black Knight":
"I can live with losing the good fight,
 but i can not live without fighting it".
"Well on second thought, maybe not."

new topic     » topic index » view message » categorize

2. Re: Minor bug found in 3.1 and previous

Al Getz wrote:
> 
> --program:
> constant x=1
> x=2
> --end program
> 
> --error message:
> C:\Euphoria\Projects\Test\test.exw:2
> x has not been declared
> x=2
> ^
> 
> Press Enter
> --end message
> 
> 
> Error message should be "May not change the value of a constant",
> or something like that.
> 
> 
> Al
> 
> E boa sorte com sua programacao Euphoria!
> 
> 
> My bumper sticker: "I brake for LED's"
> 

Al:

  You forgot the COMMA after x=1

  
Bernie

My files in archive:
WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API 

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

new topic     » goto parent     » topic index » view message » categorize

3. Re: Minor bug found in 3.1 and previous

Bernie Ryan wrote:
> 
> Al Getz wrote:
> > 
> > --program:
> > constant x=1
> > x=2
> > --end program
> > 
> > --error message:
> > C:\Euphoria\Projects\Test\test.exw:2
> > x has not been declared
> > x=2
> > ^
> > 
> > Press Enter
> > --end message
> > 
> > 
> > Error message should be "May not change the value of a constant",
> > or something like that.
> > 
> > 
> > Al
> > 
> > E boa sorte com sua programacao Euphoria!
> > 
> > 
> > My bumper sticker: "I brake for LED's"
> > 
> 
> Al:
> 
>   You forgot the COMMA after x=1
> 
>   
> Bernie
> 
> My files in archive:
> WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API 
> 
> Can be downloaded here:
> <a
> href="http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan">http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan</a>

Hi Bernie,


What comma are you talking about?  There is no comma in there.


Take care,
Al

E boa sorte com sua programacao Euphoria!


My bumper sticker: "I brake for LED's"

 From "Black Knight":
"I can live with losing the good fight,
 but i can not live without fighting it".
"Well on second thought, maybe not."

new topic     » goto parent     » topic index » view message » categorize

4. Re: Minor bug found in 3.1 and previous

Al Getz wrote:
> 
> --program:
> constant x=1
> x=2
> --end program
> 
> --error message:
> C:\Euphoria\Projects\Test\test.exw:2
> x has not been declared
> x=2
> ^
> 
> Press Enter
> --end message
> 
> 
> Error message should be "May not change the value of a constant",
> or something like that.

Yes, that would be a better message.
You've caught the parser and scanner at an awkward moment.
What's happening here is that you're making the scanner
look up x in the symbol table, when the parser hasn't quite
finished the constant declaration of x. The fact that
you enter a new-line character after constant x = 1
is no more significant than typing a blank, and
the parser needs to see the next scanner token to be sure that
the constant declaration is really finished. You might have
had:
constant x = 1
    + 1  -- x is 2

for instance. Until the parser digests the next token after " = 1",
it can't be sure that the declaration is finished,
and can't record that x is a constant with value 1
in the symbol table.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

5. Re: Minor bug found in 3.1 and previous

Robert Craig wrote:
> ... Until the parser digests the next token after " = 1",
> it can't be sure that the declaration is finished,
> and can't record that x is a constant with value 1
> in the symbol table.

Actually, now that I've looked at the parser source code,
I see that the real issue is that the parser doesn't allow
the constant symbol to be visible in the symbol table, until
it can be sure that the defining expression has been fully parsed. 
This ensures that you don't use the constant symbol to define itself.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

6. Re: Minor bug found in 3.1 and previous

Robert Craig wrote:
> 
> Al Getz wrote:
> > 
> > --program:
> > constant x=1
> > x=2
> > --end program
> > 
> > --error message:
> > C:\Euphoria\Projects\Test\test.exw:2
> > x has not been declared
> > x=2
> > ^
> > 
> > Press Enter
> > --end message
> > 
> > 
> > Error message should be "May not change the value of a constant",
> > or something like that.
> 
> Yes, that would be a better message.
> You've caught the parser and scanner at an awkward moment.
> What's happening here is that you're making the scanner
> look up x in the symbol table, when the parser hasn't quite
> finished the constant declaration of x. The fact that
> you enter a new-line character after constant x = 1
> is no more significant than typing a blank, and
> the parser needs to see the next scanner token to be sure that
> the constant declaration is really finished. You might have
> had:
> }}}
<eucode>
>     constant x = 1
>     + 1  -- x is 2
> </eucode>
{{{

> for instance. Until the parser digests the next token after " = 1",
> it can't be sure that the declaration is finished,
> and can't record that x is a constant with value 1
> in the symbol table.
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>


Hi Rob,


Ok, but it looks to me like logically it is not too hard to detect
the end of a constant declaration.  Whether or not the parser can
do this yet or not i dont know, apparently it can not.

I think i see what you are talking about however, in that the
following program gives the same error:

--
constant y=2
constant x=y x=1
--

Apparently though something sees the whitespace and is able to terminate the
"x=y" part once the 'x' is encountered, it is just not able to understand
the difference
between a comma or whitespace or other, non-variable-starter characters
(which would tell it to keep parsing the constant declaration) and
an actual variable-starter character.
In other words, if it encounters a character that is in the set of
all characters that can be a variable starter then it is forced to
terminate the constant declaration.  Isnt the current set A to Z and
a to z ?  Note there is no possibilty of:

  constant x=y x  --(which would trigger an "x is not declared" error)

where the user intended

  constant x=yx


and also

  constant x=x

would probably trigger an "x is not declared" error (referring to
the second x).


Make sense or did i assume too much?


Bottom line is that the main reason i mentioned this is because
when you get the error message "x is not declared" it makes you
think you can go somewhere near the beginning of the program and
type "atom x" and all will be fine smile
Only after typing that will the real problem show itself (x was
already declared as a constant) on the next run.



Take care,
Al

E boa sorte com sua programacao Euphoria!


My bumper sticker: "I brake for LED's"

 From "Black Knight":
"I can live with losing the good fight,
 but i can not live without fighting it".
"Well on second thought, maybe not."

new topic     » goto parent     » topic index » view message » categorize

7. Re: Minor bug found in 3.1 and previous

Robert Craig wrote:
 > 
 > Al Getz wrote:
 > > 
 > > --program:
 > > constant x=1
 > > x=2
 > > --end program
 > > 
 > > --error message:
 > > C:\Euphoria\Projects\Test\test.exw:2
 > > x has not been declared
 > > x=2
 > > ^
 > > 
 > > Press Enter
 > > --end message
 > > 
 > > 
 > > Error message should be "May not change the value of a constant",
 > > or something like that.
 > 
 > Yes, that would be a better message.
 > You've caught the parser and scanner at an awkward moment.

[snip]

Rob, why not just to change the error message as:

x has not been declared or it is a constant already

???

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

8. Re: Minor bug found in 3.1 and previous

Igor Kachan wrote:
>  Robert Craig wrote:
>  > 
>  > Al Getz wrote:
>  > > 
>  > > --program:
>  > > constant x=1
>  > > x=2
>  > > --end program
>  > > 
>  > > --error message:
>  > > C:\Euphoria\Projects\Test\test.exw:2
>  > > x has not been declared
>  > > x=2
>  > > ^
>  > > 
>  > > Press Enter
>  > > --end message
>  > > 
>  > > 
>  > > Error message should be "May not change the value of a constant",
>  > > or something like that.
>  > 
>  > Yes, that would be a better message.
>  > You've caught the parser and scanner at an awkward moment.
> 
> [snip]
> 
> Rob, why not just to change the error message as:
> 
> x has not been declared or it is a constant already
> 
> ???

That would help in 1% of the cases,
while making the other 99% slightly more confusing.
I don't think that would be a good idea.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

9. Re: Minor bug found in 3.1 and previous

Robert Craig wrote:
> Igor Kachan wrote:
> >  Robert Craig wrote:
> > > Al Getz wrote:
> > > > 
> > > > --program:
> > > > constant x=1
> > > > x=2
> > > > --end program
> > > > 
> > > > --error message:
> > > > C:\Euphoria\Projects\Test\test.exw:2
> > > > x has not been declared
> > > > x=2
> > > > ^
> > > > 
> > > > Press Enter
> > > > --end message
> > > > 
> > > > 
> > > > Error message should be "May not change the value of a constant",
> > > > or something like that.
> > > 
> > > Yes, that would be a better message.
> > > You've caught the parser and scanner at an awkward moment.
> > 
> > [snip]
> > 
> > Rob, why not just to change the error message as:
> > 
> > x has not been declared or it is a constant already
> > 
> > ???
> 
> That would help in 1% of the cases,
> while making the other 99% slightly more confusing.
> I don't think that would be a good idea.

Rob, my percentage is -- 100% of these errors are covered
by interpreter, it is better thing to explain the sence
of a correct error message than to explain all those guts
of parser and scanner to poor user every time in 1% of
the cases, I think   smile

Just my $0.02.

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu