Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335094 - Sentences between operations should be explicitly disallowed
Summary: Sentences between operations should be explicitly disallowed
Status: CLOSED FIXED
Alias: None
Product: Epsilon
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Dimitris Kolovos CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-22 16:35 EST by Antonio Garcia-Dominguez CLA
Modified: 2013-09-01 08:14 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Antonio Garcia-Dominguez CLA 2011-01-22 16:35:29 EST
Build Identifier: 20100917-0705

A new user (or someone going back to Epsilon after a while) might write the following code, expecting it to print "A" and then "B":

"A".println();
operation f() {}
"B".println();

However, the Epsilon book says in Section 3.1: "Each
module defines a body and a number of operations. The body is a block of
statements that are evaluated when the module is executed.". From this, it can be (vaguely) understood that all statements outside the operations should be before any operation.

The reason for "B".println() not being run seems to be StatementBlockExecutor#execute. Particularly, its check "while (statementAst != null)": for the above code, statementAst is null when reaching the operator, and the loop completes without having reached "B".println().

I understand that this is the desired behaviour, as interleaving code between the operations would not work as expected anyway. Instead of running  "A".println(), parsing the operation and then running "B".println(), what Epsilon does is 1) parse all operations, and then 2) run the global statement block.

Still, in order to avoid surprising new users, I would suggest that:
- statements interleaved between operations are explicitly marked as errors in
  the EOL editor.
- make this more explicit in Section 3.1 of the Epsilon book.

Regards. Antonio


Reproducible: Always

Steps to Reproduce:
1. Run the example EOL program.
Comment 1 Dimitris Kolovos CLA 2011-01-23 16:13:38 EST
Many thanks for reporting this!
Comment 2 Dimitris Kolovos CLA 2013-07-25 17:50:53 EDT
Fixed in the SVN. Now the editor produces a warning if any statements appear after the first operation in an EOL/EGL file.
Comment 3 Dimitris Kolovos CLA 2013-08-02 04:22:48 EDT
Fixed in the latest interim version. Fix will appear in 1.1.
Comment 4 Dimitris Kolovos CLA 2013-09-01 08:14:00 EDT
Fixed in 1.1