1. buggy 4.0 program

Dear EU users,

Let's try the simplest buggy program:

http://pl-euphoria.narod.ru/program.png

and output screen of ex.exe running this program:

http://pl-euphoria.narod.ru/bug.png

My mistakes are:

- a is not declared

- a doesn't have a value

So, it seems to me that ex.exe doesn't catch the mistakes properly and doesn't point to real place of mistake - it points to good puts() now.

Or, maybe, this is some new behaviour of ex.exe?

Regards, Igor Kachan kinz@peterlink.ru

new topic     » topic index » view message » categorize

2. Re: buggy 4.0 program

kinz said...

Dear EU users,

Let's try the simplest buggy program:

http://pl-euphoria.narod.ru/program.png

and output screen of ex.exe running this program:

http://pl-euphoria.narod.ru/bug.png

My mistakes are:

- a is not declared

- a doesn't have a value

So, it seems to me that ex.exe doesn't catch the mistakes properly and doesn't point to real place of mistake - it points to good puts() now.

Or, maybe, this is some new behaviour of ex.exe?

Yes, that is definitely a bug in the error reporting code. Thanks for finding that.

Matt

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

3. Re: buggy 4.0 program

mattlewis said...

Yes, that is definitely a bug in the error reporting code. Thanks for finding that.

That's happening to me a lot. Hopefully someday I'll find time to file a report. getlost

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

4. Re: buggy 4.0 program

euphoric said...
mattlewis said...

Yes, that is definitely a bug in the error reporting code. Thanks for finding that.

That's happening to me a lot. Hopefully someday I'll find time to file a report. getlost

CK, LOLoLoLoLoLoLoLOL

A great happiness was just under your boots.

Take my sorry instead smile

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

5. Re: buggy 4.0 program

euphoric said...
mattlewis said...

Yes, that is definitely a bug in the error reporting code. Thanks for finding that.

That's happening to me a lot. Hopefully someday I'll find time to file a report. getlost

You file reports all the time. Give someone else a chance, fer cryin out loud.

This is now fixed in r1245, BTW.

Matt

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

6. Re: buggy 4.0 program

mattlewis said...
euphoric said...

That's happening to me a lot. Hopefully someday I'll find time to file a report. getlost

You file reports all the time. Give someone else a chance, fer cryin out loud.

Maybe I should adopt some pseudonyms. grin

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

7. Re: buggy 4.0 program

mattlewis said...

Yes, that is definitely a bug in the error reporting code. Thanks for finding that.

Not quite fixed yet though ...

---- 
? a 
printf(1, "%d test\n", a) 
integer a = 1 
---- 
Results said...

c:\temp>exwc test.ex 
test.ex:2 
Errors resolving the following references: 
        test.ex (2): a 
        test.ex (2): a 
 
printf(1, "%d test\n", a) 
                        ^ 
 
 
Press Enter 

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

8. Re: buggy 4.0 program

DerekParnell said...
mattlewis said...

Yes, that is definitely a bug in the error reporting code. Thanks for finding that.

Not quite fixed yet though ...

Ok, fine, spoilsport. Fixed in r1247.

Matt

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

9. Re: buggy 4.0 program

mattlewis said...
DerekParnell said...
mattlewis said...

Yes, that is definitely a bug in the error reporting code. Thanks for finding that.

Not quite fixed yet though ...

Ok, fine, spoilsport. Fixed in r1247.

Matt

TEST TEST

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

10. Re: buggy 4.0 program

mattlewis said...

Ok, fine, spoilsport. Fixed in r1247.

So, we and you have different interpreters now. Let's update the packages, available on RDS site, for better alpha-testing. Why not?

Regards, Igor Kachan kinz@peterlink.ru

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

11. Re: buggy 4.0 program

kinz said...

So, we and you have different interpreters now. Let's update the packages, available on RDS site, for better alpha-testing. Why not?

I think we should probably move to weekly releases of alpha's. If, every time a bug is fix, a new release is made, the devs would not get anything done but releasing updates. A weekly update may be feasable. Typically, the way a software project works is an alpha is released, many people use it, report 100 bugs, and a very good percentage of those bugs are fixed, then the 2nd alpha is released.

Jeremy

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

12. Re: buggy 4.0 program

jeremy said...
kinz said...

So, we and you have different interpreters now. Let's update the packages, available on RDS site, for better alpha-testing. Why not?

I think we should probably move to weekly releases of alpha's. If, every time a bug is fix, a new release is made, the devs would not get anything done but releasing updates. A weekly update may be feasable. Typically, the way a software project works is an alpha is released, many people use it, report 100 bugs, and a very good percentage of those bugs are fixed, then the 2nd alpha is released.

Ok, thanks, do not be in a hurry please.

Regards, Igor Kachan kinz@peterlink.ru

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

13. Re: buggy 4.0 program

kinz said...

So, we and you have different interpreters now. Let's update the packages, available on RDS site, for better alpha-testing. Why not?

Ok, I have all new binaries now and can
compile the recent ones on my machine as well.

Let's see that simplest buggy program again:

http://pl-euphoria.narod.ru/program.png

and the interpreters' output, version 1.0:

http://pl-euphoria.narod.ru/1.0.png

bilingual version 2.5, English mode:

http://pl-euphoria.narod.ru/2.5e.png

bilingual version 2.5, Russian mode:

http://pl-euphoria.narod.ru/2.5r.png

the last version of 3 series, 3.1.1:

http://pl-euphoria.narod.ru/3.1.1.png

and almost the recent revision of 4.0:

http://pl-euphoria.narod.ru/4.0.1249.png

Do you see that there is nothing to do with
4.0 error message about that a.e program?

In that program, there is just single non-declared symbol,
which is a real error.
But 4.0 interpreters still tell us about "resolving" and
point to the empty place just after the real error place.

Regards,
Igor Kachan
kinz@peterlink.ru

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

14. Re: buggy 4.0 program

kinz said...

Do you see that there is nothing to do with
4.0 error message about that a.e program?

In that program, there is just single non-declared symbol,
which is a real error.
But 4.0 interpreters still tell us about "resolving" and
point to the empty place just after the real error place.

Regards,
Igor Kachan
kinz@peterlink.ru

Hi Igor:
Good job getting all binaries working !

The reason for error message "resolving" and
point to the empty place just after the real error place.
is because Matt added forward referencing.

When Interpreter parses the code Matt looks for forward references and
at the end of all the code parser does not locate 'a' so parser
places pointer at very end of code because it did not have any way
to know where to place the pointer.

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

15. Re: buggy 4.0 program

kinz said...

http://pl-euphoria.narod.ru/4.0.1249.png

Do you see that there is nothing to do with
4.0 error message about that a.e program?

In that program, there is just single non-declared symbol,
which is a real error.
But 4.0 interpreters still tell us about "resolving" and
point to the empty place just after the real error place.

Could you copy the console output into the posts, please? It would make these threads easier to follow. Use the triple curly brackets (I notice that they're not explicitly listed in the help, but you can use the Section: Plain link if you're using Firefox, at leastYMMV with other browsers) like so:

{{{ 
bug.exw:1 
Errors resolving the following references: 
        bug.exw (1): a 
 
? a 
   ^ 
}}}

I'll see how I can make it show the beginning of the token instead of the end.

Matt

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

16. Re: buggy 4.0 program

mattlewis said...
kinz said...

http://pl-euphoria.narod.ru/4.0.1249.png

Do you see that there is nothing to do with
4.0 error message about that a.e program?

In that program, there is just single non-declared symbol,
which is a real error.
But 4.0 interpreters still tell us about "resolving" and
point to the empty place just after the real error place.

Could you copy the console output into the posts, please? It would make these threads easier to follow. Use the triple curly brackets (I notice that they're not explicitly listed in the help, but you can use the Section: Plain link if you're using Firefox, at leastYMMV with other browsers) like so:

{{{ 
bug.exw:1 
Errors resolving the following references: 
        bug.exw (1): a 
 
? a 
   ^ 
}}}

I'll see how I can make it show the beginning of the token instead of the end.

Matt, my trouble is not only about pointer position, but, mainly, about real
sense of the issued error message.
There was nothing to resolve in a.e, single reference doesn't require any resolving
at all. But the message just confuses a user - errorS, resolving, referenceS.
There was just non-declared name, single non-declared name in single file.
But pointer ... pointer is almost good ... just x-=1.
So, what about the sense of 4.0 message, sorry?
We have 15 years old tradition of that standard message.

Regards,
Igor Kachan
kinz@peterlink.ru

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

17. Re: buggy 4.0 program

Matt, my trouble is not only about pointer position, but, mainly, about real
sense of the issued error message.
There was nothing to resolve in a.e, single reference doesn't require any resolving
at all. But the message just confuses a user - errorS, resolving, referenceS.
There was just non-declared name, single non-declared name in single file.
But pointer ... pointer is almost good ... just x-=1.
So, what about the sense of 4.0 message, sorry?
We have 15 years old tradition of that standard message.

Regards,
Igor Kachan
kinz@peterlink.ru

[/quote] Matt & Igor:
How about:
Missing reference: Variable 'a'

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

18. Re: buggy 4.0 program

bernie said...

Matt & Igor:
How about:
Missing reference: Variable 'a'

Bernie, the problem seems to be more serious
than just new wording of the error message.
See please the screenshot of the next even
more simple programm b.e:

http://pl-euphoria.narod.ru/b.e.png

and outputs of 1.0 - 3.1.1:

http://pl-euphoria.narod.ru/b.e-3.1.1.png

and 4.0:

http://pl-euphoria.narod.ru/b.e-4.0.png

Sorry, Matt, these pictures of live console look much more
informative than formatted plain text copies of them, I think.

Regards,
Igor Kachan
kinz@peterlink.ru

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

19. Re: buggy 4.0 program

kinz said...
bernie said...

 Matt & Igor: 
 How about: 
 Missing reference: Variable 'a' 

Bernie, the problem seems to be more serious 
than just new wording of the error message. 
See please the screenshot of the next even 
more simple programm b.e: 
http://pl-euphoria.narod.ru/b.e.png

and outputs of 1.0 - 3.1.1:

http://pl-euphoria.narod.ru/b.e-3.1.1.png

and 4.0:

http://pl-euphoria.narod.ru/b.e-4.0.png

Igor, please let me explain why the v3 message is different to the v4 message.

In v3, when a reference to an identifier was found, it checked that the identifier had already been declared. If it hasn't it issued the message saying that 'a' had not been declared.

v4 has a different approach. In v4, an identifier not is discovered missing until all the program has been parsed. Instead, it assumes that a reference to an unknown identifier is valid and continues with the parsing effort. In this case, it finds two adjacent identifiers at the begining of a statement, namely "a" and "puts". However, the only things that can come legally after an identifier at the begining of a statement is one of the assignment operations, a left-parethensis, or a left-square bracket. Certainly one cannot have two adjacent identifiers. So in that context, the v4 message "Syntax error - expecting to see ..." is sensible.

Also, in v4, if there are syntax errors, it doesn't go on to tell you about possible 'missing' identifiers - because it maybe that certain syntax errors cause identifiers to go missing, e.g.

---- 
integer a() 
a = 1 
---- 

It is not much use reporting that the declaration is invalid and reporting that the 'a' is missing.

In your previous message, the one that Bernie replied to, I wasn't sure if you were complaining about the content of the message or that is used the plural form when only one variable was missing. There is not much to be gained by using singular forms in this message context so I can't see that we will be attempting to do so.


Note how I used some creole tags in this reply to make it easier to write and read.

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

20. Re: buggy 4.0 program

kinz said...

Sorry, Matt, these pictures of live console look much more
informative than formatted plain text copies of them, I think.

I have to imagine that they are. They don't look like anything to me. They won't load.

Matt

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

21. Re: buggy 4.0 program

When I look at the error about a missing identifier, I think, "Oh, puts must now be a function." When I see an error about "a is not defined", I think, "Oops, I forgot to put a type in front of a." The power of Euphoria is that the error reported very clearly told me where the problem was, making it very quick to fix. I'm glad some kind of compile-time error is being generated; but I'd rather not go back to the bad old days of C where an error on line 400 could mean a bug in line 25.

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

22. Re: buggy 4.0 program

m_sabal said...

When I look at the error about a missing identifier,

I meant, missing operator.

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

23. Re: buggy 4.0 program

DerekParnell said...
kinz said...
bernie said...

 Matt & Igor: 
 How about: 
 Missing reference: Variable 'a' 

Bernie, the problem seems to be more serious 
than just new wording of the error message. 
See please the screenshot of the next even 
more simple programm b.e: 
http://pl-euphoria.narod.ru/b.e.png

and outputs of 1.0 - 3.1.1:

http://pl-euphoria.narod.ru/b.e-3.1.1.png

and 4.0:

http://pl-euphoria.narod.ru/b.e-4.0.png

Igor, please let me explain why the v3 message is different to the v4 message.

In v3, when a reference to an identifier was found, it checked that the identifier had already been declared. If it hasn't it issued the message saying that 'a' had not been declared.

Ok, "declare then use", old good familiar safe simple reliable scheme.

DerekParnell said...

v4 has a different approach. In v4, an identifier not is discovered missing until all the program has been parsed.

Ok, why not? But my buggy b.e program is complete, all, so to say.
There is nothing to parse any more, I do not include libs. My program
is complete but just buggy. And similar buggy 'a' we may meet in some big program too,
as typo etc etc.

DerekParnell said...

Instead, it assumes that a reference to an unknown identifier is valid
and continues with the parsing effort.

Why does it "think", so to say, that I'm going to use or already using the forward
referencing? I do not need the forward referencing at all, for now, maybe.

DerekParnell said...

In this case, it finds two adjacent identifiers at the begining of a statement,
namely "a" and "puts". However, the only things that can come legally
after an identifier at the begining of a statement is one of the assignment operations, a left-parethensis,
or a left-square bracket. Certainly one cannot have two adjacent identifiers.
So in that context, the v4 message "Syntax error - expecting to see ..." is sensible.

Well, all said is clear enough, thanks.
Let's now just follow the recommendations of the interpreter messages.
Remember please, it wanted to see some '=' in b.e,
let's give it expected one:

--c.e 
a= 
puts(1,"test") 
-- 

http://pl-euphoria.narod.ru/c.e.png

It wanted to see 'expression' in c.e,
let's give it expression:

--d.e 
a=1 
puts(1,"test") 
-- 

http://pl-euphoria.narod.ru/d.e.png

It found some errors in d.e, let's give it one bug more:

--e.e 
a=1- 
puts(1,"test") 
-- 

http://pl-euphoria.narod.ru/e.e.png

It wanted to see 'expression' in e.e, but do not see the error,
let's give it one bug more:

--f.e 
a=1-& 
puts(1,"test") 
-- 

http://pl-euphoria.narod.ru/f.e.png

Good, pointer shows '&' exactly.
But it wanted expression here. Let's give it
expression:

--g.e 
a=1-sin(a) 
puts(1,"test") 
-- 

http://pl-euphoria.narod.ru/g.e.png

It sees two unresolved references now.
But bug sits on different place.
So, it allows you to write buggy program and hopes
to see resolved references some future time.
Is it good? I do not think it is good.
Let's see yet another buggy program:

--h.e 
a=1-sin(a)+cos(a)*tan(a)/log(b)+power(a,b)-10 
puts(1,"test") 
-- 

http://pl-euphoria.narod.ru/h.e.png

It sees a bunch of unresolved references, but just two
bugs sit on a different place.

So, there may be two different situations in a program:
presence of non-declared symbol(s) and conflict of declared symbols.
Non-declared symbols have to be just declared.
Error message - something like to "Can not find declaration of: [list]"
Or "Declare please: [list]", or just old good message of 1.0.
But conflict of declared symbols have to be resolved.
Error massage - "Unresolved conflict of: [list]" or something similar.

DerekParnell said...

Also, in v4, if there are syntax errors, it doesn't go on to tell you about possible
'missing' identifiers - because it maybe that certain syntax errors cause identifiers to go missing, e.g.

---- 
integer a() 
a = 1 
---- 

It is not much use reporting that the declaration is invalid and reporting that the 'a' is missing.

I do not have some certain opinion on this one for now.

DerekParnell said...

In your previous message, the one that Bernie replied to, I wasn't sure if you were complaining about the content of the message or that is used the plural form when only one variable was missing. There is not much to be gained by using singular forms in this message context so I can't see that we will be attempting to do so.

There are some neutral forms well suitable for both plural and singular cases
in Russian and in English as well, I'm sure.
My trouble was and is about content mainly.

DerekParnell said...

Note how I used some creole tags in this reply to make it easier to write and read.

Thank you very much for very useful examples.

Regards,
Igor Kachan
kinz@peterlink.ru

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

24. Re: buggy 4.0 program

kinz said...
DerekParnell said...

Igor, please let me explain why the v3 message is different to the v4 message.

In v3, when a reference to an identifier was found, it checked that the identifier had already been declared. If it hasn't it issued the message saying that 'a' had not been declared.

Ok, "declare then use", old good familiar safe simple reliable scheme.

DerekParnell said...

v4 has a different approach. In v4, an identifier not is discovered missing until all the program has been parsed.

Ok, why not? But my buggy b.e program is complete, all, so to say.
There is nothing to parse any more, I do not include libs. My program
is complete but just buggy. And similar buggy 'a' we may meet in some big program too,
as typo etc etc.

Euphoria is a single pass parser, so at the time, we cannot know what will come next, or how long it will go on. Forward references are now legal, and will ultimately make coding easier. For example, if you include something in your program, you will no longer have to worry about them both including each other, requiring reorganization of code, or lots of routine ids.

A nice side effect of forward referencing is that we can report all your typos at one go, so that you can fix them all at once, without the cycle of run-fix-run-...

kinz said...
DerekParnell said...

Instead, it assumes that a reference to an unknown identifier is valid
and continues with the parsing effort.

Why does it "think", so to say, that I'm going to use or already using the forward
referencing? I do not need the forward referencing at all, for now, maybe.

Forward referencing is a part of the language. So it thinks that you may be trying to use a forward reference the same way that a square bracket tells it that you're doing a subscript operation. If you use the standard library, then you likely are using forward referencing. There are several places where this made the libraries cleaner and easier to maintain.

I'll address the rest of the post in a separate message...

Matt

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

25. Re: buggy 4.0 program

kinz said...
--g.e 
a=1-sin(a) 
puts(1,"test") 
-- 

http://pl-euphoria.narod.ru/g.e.png

It sees two unresolved references now.
But bug sits on different place.
So, it allows you to write buggy program and hopes
to see resolved references some future time.
Is it good? I do not think it is good.

No, once it can determine that there are bugs in your program, it lets you know. And, by the way, it gives you more information (though we obviously have a little work to do for reporting the correct character in the line).

kinz said...

Let's see yet another buggy program:

--h.e 
a=1-sin(a)+cos(a)*tan(a)/log(b)+power(a,b)-10 
puts(1,"test") 
-- 

http://pl-euphoria.narod.ru/h.e.png

It sees a bunch of unresolved references, but just two
bugs sit on a different place.

Yes, in this case, the obvious bug is that you never declared or initialized a and b. The error generation is somewhat naive, in that it doesn't check for duplicates on the same line. It might be better to condense that a bit. But we definitely need to report all of those. Suppose they were typos, and we only reported one. Then you would change the first instance, re-run, and you'd get the same message. I think this would be very frustrating. Obviously, your example is very simple, but consider something like:

sequence foo 
enum SOMETHING, SOMETHING_ELSE 
   ... 
 
? foo[SOMETHIGN][SOMETHING_ELSE][3][SOMETHIGN..$] 

If the error message didn't alert you to the fact that there were two errors for SOMETHIGN, it would be easy to spot the first, but less easy to spot the second. This would be especially true for multi-line expressions, where the reporting is usually on the first line of the expression.

kinz said...

So, there may be two different situations in a program:
presence of non-declared symbol(s) and conflict of declared symbols.
Non-declared symbols have to be just declared.
Error message - something like to "Can not find declaration of: [list]"
Or "Declare please: [list]", or just old good message of 1.0.
But conflict of declared symbols have to be resolved.
Error massage - "Unresolved conflict of: [list]" or something similar.

I'm not against changing the text of the errors. It seems clear to me, but it's my native language, and I'm probably too close to the internals, so I can see how it would come across as confusing jargon to someone not used to digging around in the guts of the interpreter.

kinz said...

There are some neutral forms well suitable for both plural and singular cases
in Russian and in English as well, I'm sure.
My trouble was and is about content mainly.

I don't think there are such constructs in English, unless you put the s in parentheses, or something like that.

   Errors resolving the following reference(s): 
Matt

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

26. Re: buggy 4.0 program

mattlewis said...

I don't think there are such constructs in English, unless you put the s in parentheses, or something like that.

   Errors resolving the following reference(s): 
Matt

You could be extra terse and write,

The following had errors and needs to be resolved:

I prefer the s in parentheses, myself.

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

27. Re: buggy 4.0 program

m_sabal said...

When I look at the error about a missing identifier, I think, "Oh, puts must now be a function." When I see an error about "a is not defined", I think, "Oops, I forgot to put a type in front of a." The power of Euphoria is that the error reported very clearly told me where the problem was, making it very quick to fix.

The art of error reporting is difficult. Consider ...

---- 
integer a  
. . . lots of code . . . 
a 
puts(1, "test) 
----- 

Now 'a' is not missing. What should the error message be?

m_sabal said...

I'm glad some kind of compile-time error is being generated; but I'd rather not go back to the bad old days of C where an error on line 400 could mean a bug in line 25.

And in this case it isn't. The error message is very local to the site of the error.

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

28. Re: buggy 4.0 program

mattlewis said...
kinz said...
DerekParnell said...

Igor, please let me explain why the v3 message is different to the v4 message.

In v3, when a reference to an identifier was found, it checked that the identifier had already been declared. If it hasn't it issued the message saying that 'a' had not been declared.

Ok, "declare then use", old good familiar safe simple reliable scheme.

DerekParnell said...

v4 has a different approach. In v4, an identifier not is discovered missing until all the program has been parsed.

Ok, why not? But my buggy b.e program is complete, all, so to say.
There is nothing to parse any more, I do not include libs. My program
is complete but just buggy. And similar buggy 'a' we may meet in some big program too,
as typo etc etc.

Euphoria is a single pass parser, so at the time, we cannot know what will come next, or how long it will go on. Forward references are now legal, and will ultimately make coding easier. For example, if you include something in your program, you will no longer have to worry about them both including each other, requiring reorganization of code, or lots of routine ids.

Matt, Euphoria is a two pass system (2.5 and up) - it parses and compiles into IL on the first pass, and then it runs the IL code on the second pass.
Now it seems to be parsing to the end of code and it doesn't stop on the first error.
Why do you say that we cannot know what will come next, or how long it will go on?
After the parse\compile pass, the first pass, we have the entire picture of code and all compile time bugs - undeclared names, unresolved conflicts, syntax errors etc.
If there is no a bug in the source code, IL code runs. If there is something wrong in the source code, we have all data to point properly to all wrong places exactly.
No?
Also, the parser itself seems to be two pass now - ifdefs and then code itself.

mattlewis said...

A nice side effect of forward referencing is that we can report all your typos at one go, so that you can fix them all at once, without the cycle of run-fix-run-...

Matt, there seems to be a contradiction in your words, you say "we cannot know" above, and now, you say "we can report".

mattlewis said...
kinz said...
DerekParnell said...

Instead, it assumes that a reference to an unknown identifier is valid
and continues with the parsing effort.

Why does it "think", so to say, that I'm going to use or already using the forward
referencing? I do not need the forward referencing at all, for now, maybe.

Forward referencing is a part of the language. So it thinks that you may be trying to use a forward reference the same way that a square bracket tells it that you're doing a subscript operation. If you use the standard library, then you likely are using forward referencing. There are several places where this made the libraries cleaner and easier to maintain.

Maybe, but I do not like forward reference, same as goto, sorry, and probably will not use them both in my progs, probably never.
My 10 years old habit declare then use is strong and very useful for my health, thanks to Rob smile

mattlewis said...

I'll address the rest of the post in a separate message...

Ok, I'll read it.

Regards,
Igor Kachan
kinz@peterlink.ru

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

29. Re: buggy 4.0 program

kinz said...
mattlewis said...

Euphoria is a single pass parser, so at the time, we cannot know what will come next, or how long it will go on. Forward references are now legal, and will ultimately make coding easier. For example, if you include something in your program, you will no longer have to worry about them both including each other, requiring reorganization of code, or lots of routine ids.

Matt, Euphoria is a two pass system (2.5 and up) - it parses and compiles into IL on the first pass, and then it runs the IL code on the second pass.

You're changing the definition. The parser is single pass. Please, don't argue this point, because you're wrong. The parser reads the code sequentially once. Hence, single pass.

kinz said...

Now it seems to be parsing to the end of code and it doesn't stop on the first error.
Why do you say that we cannot know what will come next, or how long it will go on?
After the parse\compile pass, the first pass, we have the entire picture of code and all compile time bugs - undeclared names, unresolved conflicts, syntax errors etc.
If there is no a bug in the source code, IL code runs. If there is something wrong in the source code, we have all data to point properly to all wrong places exactly.
No?

It stops as soon as it finds an error. However, the point at which we can prove an error has changed due to forward referencing. It's a subtle but important distinction. If the only problem was that there were typos or undeclared variables or routines, then yes, we can report on all of the places in the code where that happened. If you have a syntax error, however, we report that immediately, without continuing to look at any more code, just like always.

kinz said...

Also, the parser itself seems to be two pass now - ifdefs and then code itself.

No, it's still single pass. The effect of the ifdefs is to ignore code within an ifdef that evaluates to false. So if you have ifdef DEBUG# in your code, then if DEBUG isn't defined, the code within that ifdef is treated as though it were commented out.

kinz said...

A nice side effect of forward referencing is that we can report all your typos at one go, so that you can fix them all at once, without the cycle of run-fix-run-...

Matt, there seems to be a contradiction in your words, you say "we cannot know" above, and now, you say "we can report".
[/quote]

Perhaps I was unclear. We cannot know at the point of reading a variable name that it is undeclared in the program. We can only know that when we have read all of the code.

kinz said...

Maybe, but I do not like forward reference, same as goto, sorry, and probably will not use them both in my progs, probably never.
My 10 years old habit declare then use is strong and very useful for my health, thanks to Rob smile

That's fine, although if you use the standard library, you will almost definitely be using code that uses forward referencing.

Matt

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

30. Re: buggy 4.0 program

mattlewis said...

Perhaps I was unclear. We cannot know at the point of reading a variable name that it is undeclared in the program. We can only know that when we have read all of the code.

kinz said...

Maybe, but I do not like forward reference, same as goto, sorry, and probably will not use them both in my progs, probably never.
My 10 years old habit declare then use is strong and very useful for my health, thanks to Rob smile

That's fine, although if you use the standard library, you will almost definitely be using code that uses forward referencing.

Matt, be so kind, point please some clear example of forward referencing in standard library.
I've searched for "forward referencing" in all EU dir but got nothing.

Regards,
Igor Kachan
kinz@peterlink.ru

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

31. Re: buggy 4.0 program

kinz said...

point please some clear example of forward referencing in standard library.

In map.e; "convert_to_small_map()" and "convert_to_large_map()". These are referenced before they are declared.

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

32. Re: buggy 4.0 program

DerekParnell said...
m_sabal said...

When I look at the error about a missing identifier, I think, "Oh, puts must now be a function." When I see an error about "a is not defined", I think, "Oops, I forgot to put a type in front of a." The power of Euphoria is that the error reported very clearly told me where the problem was, making it very quick to fix.

The art of error reporting is difficult. Consider ...

---- 
integer a  
. . . lots of code . . . 
a 
puts(1, "test) 
----- 

Now 'a' is not missing. What should the error message be?

The standard error message is good, I think:

...
j.e:6
Syntax error - expected to see =, +=, -=, *=, /= or &=
puts(1, "test)
...^

but the pointer stands on improper place. BTW, in old versions
of Euphoria too. It has to show the blank, gap, between 'a' and 'puts',
where an operator is expected. And puts() is proper here, the real bug
sits in gap just after 'a', so I'd like to see, for example:

...
j.e:6
Syntax error - expected to see =, +=, -=, *=, /= or &=
a
.^

Regards,
Igor Kachan
kinz@peterlink.ru

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

33. Re: buggy 4.0 program

DerekParnell said...
kinz said...

point please some clear example of forward referencing in standard library.

In map.e; "convert_to_small_map()" and "convert_to_large_map()". These are referenced before they are declared.

Ok, thanks.
I ran this lib with ex.exe r1261. Nothing happened, good, there is no compile time errors in this lib and in all included libs. Then I renamed convert_to_small_map() and convert_to_large_map() procedures to convert_to_small_map_() and convert_to_large_map_(). So, my new map.e doesn't have any syntax errors, but just two non-declared procedures and two some extra procedures, without syntax errors too.
I ran this changed lib with ex.exe r1261 and got the output screen:
http://pl-euphoria.narod.ru/fwr.png
My question, why the error handling system can not separate the non-declared things and other things of the "referencing error" series?

Ok, I've changed the error message in fwdref.e, compiled new ex.exe r1261+ and ran again my test version of map.e with new ex.exe r1261+.
You can see the output screen:
http://pl-euphoria.narod.ru/fwr1.png
My question, which screen is better? smile

Regards,
Igor Kachan
kinz@peterlink.ru

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

34. Re: buggy 4.0 program

kinz said...

My question, why the error handling system can not separate the non-declared things and other things of the "referencing error" series?

Please define the difference between the two from the parser's perspective. The answer is that there isn't any. It can't know what you were thinking about, to know that you "meant to" declare something, or whether you just typed something incorrectly.

Matt

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

35. Re: buggy 4.0 program

mattlewis said...
kinz said...

My question, why the error handling system can not separate the non-declared things and other things of the "referencing error" series?

Please define the difference between the two from the parser's perspective. The answer is that there isn't any. It can't know what you were thinking about, to know that you "meant to" declare something, or whether you just typed something incorrectly.

Non-declared exactly:
- the EOF is reached and
- there is no the declaration of the symbol in the whole program.
(The current parser's perspective is zero, so to say. It has nothing to do any more.)

Other things of the "referencing error" series - you do know them better than anyone here.

Regards,
Igor Kachan
kinz@peterlink.ru

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

36. Re: buggy 4.0 program

kinz said...
mattlewis said...
kinz said...

My question, why the error handling system can not separate the non-declared things and other things of the "referencing error" series?

Please define the difference between the two from the parser's perspective. The answer is that there isn't any. It can't know what you were thinking about, to know that you "meant to" declare something, or whether you just typed something incorrectly.

Non-declared exactly:
- the EOF is reached and
- there is no the declaration of the symbol in the whole program.
(The current parser's perspective is zero, so to say. It has nothing to do any more.)

But if it sees a different error (a syntax error of the missing operator type for example) then the parser stops. The parser stops. It does not continue to parse the rest of the program to see if the symbol is ever declared or not, so at the point where the syntax error is reported, it is too soon for the parser to know about undeclared variables/unresolved forward references. The only way to fix this (without getting rid of forward referencing altogether) is to add an extra pass to the parser, with the variable reference resolving occuring on the first pass and the syntax error check on the second pass.

I'm not sure if there is a difference between undeclared variables and unresolved forward references (that and conflicting references - variable declared twice - are the only reference errors that I know of).

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

37. Re: buggy 4.0 program

kinz said...

My question, which screen is better? smile

The current message is better because it does not tell the coder what to do, instead it tells the coder some facts and allows the coder to fix the error in any manner that they see fit.

If the parser finds an unresolved reference it could because of a number reasons:

  1. The coder has not attempted to declared the symbol anywhere (which was your assumption)
  2. The coder has declared the symbol but not included it
  3. The coder attempted to declared the symbol, but got the spelling wrong
  4. The coder has declared the symbol but the reference(s) was mispelled

And I'm sure there are other reasons too.

The point is, rather than insist that the problem be fixed by "Please declare..." messages, we just tell the coder what the current situation actually is. Just the facts.

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

38. Re: buggy 4.0 program

jimcbrown said...
kinz said...
mattlewis said...
kinz said...

My question, why the error handling system can not separate the non-declared things and other things of the "referencing error" series?

Please define the difference between the two from the parser's perspective. The answer is that there isn't any. It can't know what you were thinking about, to know that you "meant to" declare something, or whether you just typed something incorrectly.

Non-declared exactly:
- the EOF is reached and
- there is no the declaration of the symbol in the whole program.
(The current parser's perspective is zero, so to say. It has nothing to do any more.)

But if it sees a different error (a syntax error of the missing operator type for example) then the parser stops. The parser stops.

Yes, I know that now, so I say 'the EOF (End Of File) is reached'. The parser can only reach EOF if there is no the different error. So, if parser sees EOF then all detected errors are of the "referencing error" series. And if there is no daclaration of some of them in the whole program then these ones are non-declared. Who cares why do they look as non-declared from the point of view of the correct program? So "Please declare ... properly: [list]".

jimcbrown said...

It does not continue to parse the rest of the program to see if the symbol is ever declared or not, so at the point where the syntax error is reported, it is too soon for the parser to know about undeclared variables/unresolved forward references.

Ok, I know now that it does not continue to parse the rest of the program. And my question is why? Why it can not collect the different errors in same manner as "referencing error" series?

jimcbrown said...

The only way to fix this (without getting rid of forward referencing altogether) is to add an extra pass to the parser, with the variable reference resolving occuring on the first pass and the syntax error check on the second pass.

Why not to collect all at all errors to EOF and then generate complete error message after single pass?

jimcbrown said...

I'm not sure if there is a difference between undeclared variables and unresolved forward references (that and conflicting references - variable declared twice - are the only reference errors that I know of).

The difference seems to be very clear, if EOF is reached.

Regards,
Igor Kachan
kinz@peterlink.ru

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

39. Re: buggy 4.0 program

kinz said...

Ok, I know now that it does not continue to parse the rest of the program. And my question is why? Why it can not collect the different errors in same manner as "referencing error" series?

Why not to collect all at all errors to EOF and then generate complete error message after single pass?

Because experience with many compilers that attempt this stratgey has shown that a syntax error can itself cause subsequent errors. If you fix the first error then the other errors are magically not there anymore, thus indicating that false or unnecessary error messages were displayed. So, nowadays with our much faster edit-parse cycles, it is more efficient to report on the first serious error and stop further parsing until that is fixed.

I have fond memories of compiling COBOL programs that will report pages and pages of errors because I mispelled "WORKING-STORAGE SECTION." or left out the "ID DIVISION".

Euphoria, both v3 and v4 are doing better by stopping on the first serious error.

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

40. Re: buggy 4.0 program

kinz said...
jimcbrown said...

It does not continue to parse the rest of the program to see if the symbol is ever declared or not, so at the point where the syntax error is reported, it is too soon for the parser to know about undeclared variables/unresolved forward references.

Ok, I know now that it does not continue to parse the rest of the program. And my question is why? Why it can not collect the different errors in same manner as "referencing error" series?

jimcbrown said...

The only way to fix this (without getting rid of forward referencing altogether) is to add an extra pass to the parser, with the variable reference resolving occuring on the first pass and the syntax error check on the second pass.

Why not to collect all at all errors to EOF and then generate complete error message after single pass?

These more 'serious' errors put the parser into an undefined state. For instance, when it though you were creating an expression, but it found a procedure, did you type the name incorrectly? Did you miss something else? Should that have simply not been there (i.e., you forgot to comment it out or delete it)? At this point, it's not clear where the next statement should begin. It might have therefore missed something very important to parsing your program (a missing end marker?) that causes the rest of the program to be unparseable, resulting in a torrent of errors (as Derek mentioned). In these cases, when the syntax cannot possibly be correct, it's better to stop the parser and report the error.

Matt

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

41. Re: buggy 4.0 program

a 
puts(1,"test") 

If you just want the facts, the error should read "incomplete statement."

a.ex:1 
Syntax error - incomplete statement 
a 
^ 
 
 
Press Enter 

a = 1 
puts(1,"test") 

Here it is more desirable to see: "a has not been declared" or the 4.0 "undefined references".

Shawn Pringle

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

42. forward data references

DerekParnell said...
kinz said...

point please some clear example of forward referencing in standard library.

In map.e; "convert_to_small_map()" and "convert_to_large_map()". These are referenced before they are declared.

Does anyone know if there are any examples of forward data references in the standard library?

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

43. Re: buggy 4.0 program

kinz said...

Yes, I know that now, so I say 'the EOF (End Of File) is reached'. The parser can only reach EOF if there is no the different error. So, if parser sees EOF then all detected errors are of the "referencing error" series. And if there is no daclaration of some of them in the whole program then these ones are non-declared. Who cares why do they look as non-declared from the point of view of the correct program? So "Please declare ... properly: [list]".

This boils down to the text of the error message that is shown. I don't really care which version ("Please declare" or "Unresolved forward references") is used.

kinz said...
jimcbrown said...

I'm not sure if there is a difference between undeclared variables and unresolved forward references (that and conflicting references - variable declared twice - are the only reference errors that I know of).

The difference seems to be very clear, if EOF is reached.

Which is?

kinz said...

Ok, I know now that it does not continue to parse the rest of the program. And my question is why? Why it can not collect the different errors in same manner as "referencing error" series?

kinz said...
jimcbrown said...

The only way to fix this (without getting rid of forward referencing altogether) is to add an extra pass to the parser, with the variable reference resolving occuring on the first pass and the syntax error check on the second pass.

Why not to collect all at all errors to EOF and then generate complete error message after single pass?

This is really complicated, as some errors leave the parser's state machine in a weird or undefined state.

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

44. Re: buggy 4.0 program

jimcbrown said...
kinz said...
jimcbrown said...

I'm not sure if there is a difference between undeclared variables and unresolved forward references (that and conflicting references - variable declared twice - are the only reference errors that I know of).

The difference seems to be very clear, if EOF is reached.

Which is?

As far as I know, the variables can not be backward declared, so the difference is clear, there is no any need to look for forward referenced variables. But procedures and functions need the parsing to the end of file, they may be forward referenced.

I think now that all forward referenced routines may have the "FR:" prefix and separate specific namespace, then parsing will be much more simple and program will have much more clear text.

Regards,
Igor Kachan
kinz@peterlink.ru

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

45. Re: buggy 4.0 program

kinz said...

As far as I know, the variables can not be backward declared

You are wrong. Variables can be referenced before they are declared.

kinz said...

I think now that all forward referenced routines may have the "FR:" prefix and separate specific namespace, then parsing will be much more simple and program will have much more clear text.

Now you're just being silly.

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

46. Re: buggy 4.0 program

DerekParnell said...
kinz said...

As far as I know, the variables can not be backward declared

You are wrong. Variables can be referenced before they are declared.

Please give me the working example in 4.0.

DerekParnell said...
kinz said...

I think now that all forward referenced routines may have the "FR:" prefix and separate specific namespace, then parsing will be much more simple and program will have much more clear text.

Now you're just being silly.

Maybe...

Regards,
Igor Kachan
kinz@peterlink

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

47. Re: buggy 4.0 program

Hi Igor:
If you try writing programs with version 4.0;
you will find how valuable the new forward reference is.
It eliminates the need for move routines around in your code.
It eliminates the need for using some routine_id's in your code.
Before you question it, try using it in your code, You will like it.
Sometimes us old men have to change our ways.
Bernie

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

48. Re: buggy 4.0 program

[quote kinz]

DerekParnell said...
kinz said...

As far as I know, the variables can not be backward declared

You are wrong. Variables can be referenced before they are declared.

Please give me the working example in 4.0.


integer a = 1 
? a 

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

49. Re: buggy 4.0 program

[quote DerekParnell]

kinz said...
DerekParnell said...
kinz said...

As far as I know, the variables can not be backward declared

You are wrong. Variables can be referenced before they are declared.

Please give me the working example in 4.0.


integer a = 1 
? a 

Just kidding ..... try this instead ...

-- file: foo.e -- 
public integer a = 1 
---- 
-- file: text.ex -- 
procedure xyz() 
integer a = 1 
end procedure 
 
 
xyz() 
 
include foo.e 
 

Currently, a forward declared variable must be declared in another file and can only be referenced inside a routine. These restriction may change.

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

50. Re: buggy 4.0 program

OMG, my fingers are not awake yet smile

-- file: foo.e -- 
public integer a 
---- 
-- file: test.ex -- 
procedure xyz() 
a = 1 
end procedure 
xyz() 
include foo.e 
new topic     » goto parent     » topic index » view message » categorize

51. Re: buggy 4.0 program

bernie said...

Hi Igor:
If you try writing programs with version 4.0;
you will find how valuable the new forward reference is.
It eliminates the need for move routines around in your code.
It eliminates the need for using some routine_id's in your code.
Before you question it, try using it in your code, You will like it.
Sometimes us old men have to change our ways.
Bernie

Does 4.0 actually allow routines in a file to be invoked before they are declared?

regards, Spock

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

52. Re: buggy 4.0 program

DerekParnell said...

OMG, my fingers are not awake yet smile

-- file: foo.e -- 
public integer a 
---- 
-- file: test.ex -- 
procedure xyz() 
a = 1 
end procedure 
xyz() 
include foo.e 

Thanks, the feature works this time, but seems to be buggy anyway.

Let's try:
http://pl-euphoria.narod.ru/fr_e.png

and see the output screen:

http://pl-euphoria.narod.ru/fr_r.png

Regrads,
Igor Kachan
kinz@peterlink.ru

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

53. Re: buggy 4.0 program

bernie said...

Hi Igor:
If you try writing programs with version 4.0;
you will find how valuable the new forward reference is.
It eliminates the need for move routines around in your code.
It eliminates the need for using some routine_id's in your code.
Before you question it, try using it in your code, You will like it.
Sometimes us old men have to change our ways.

Ok, Bernie, I'll try to learn the new features and use them smile

Regards,
Igor Kachan
kinz@peterlink.ru

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

54. Re: buggy 4.0 program

Spock said...

Does 4.0 actually allow routines in a file to be invoked before they are declared?

Yes.

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

55. Re: buggy 4.0 program

Currently, forward references do not apply to namespace identifiers. This may change.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu