Rob, no reply? Minor bug found in 3.1 and previous

new topic     » topic index » view thread      » older message » newer message

Al Getz 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.
> > 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.
> 
> 
> Al
> 
> E boa sorte com sua programacao Euphoria!
> 
> 
> My bumper sticker: "I brake for LED's"
> 


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 thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu