1. clarification needed: assigning function value and forward reference
- Posted by _tom (admin) Apr 09, 2010
- 1291 views
This first demo shows that it is possible use a routine that is declared after the request to use it:
include std/console.e display("#1 test forward referencing of routines" ) one() --two() ? two() procedure one() display("this is one") end procedure function two() display("this is two") return "" end function two() --------------------------------------------- -- executes with the display... -- #1 test forward referencing of routines -- this is one -- this is two -- {} -- this is two
The the odd thing is that the first time two() is used it must assign a value to something. The second time two() is used, a value does not have to be assigned.
include std/console.e display("#2 test forward referencing of routines" ) one() two() procedure one() display("this is one") end procedure function two() display("this is two") return "" end function two() ----------------------------------------------- -- crashes with the message... -- scope2.ex:8 -- <0068>:: expected a procedure, not a function -- two() -- ^
How do I understand (and document) this activity?
2. Re: clarification needed: assigning function value and forward reference
- Posted by jimcbrown (admin) Apr 09, 2010
- 1226 views
This makes no sense.
This is clearly a bug.
3. Re: clarification needed: assigning function value and forward reference
- Posted by mattlewis (admin) Apr 10, 2010
- 1245 views
_tom said...
This first demo shows that it is possible use a routine that is declared after the request to use it:
I've added a unit test and opened ticket:150 for this issue.
Matt
4. Re: clarification needed: assigning function value and forward reference
- Posted by mattlewis (admin) Apr 11, 2010
- 1203 views
mattlewis said...
_tom said...
This first demo shows that it is possible use a routine that is declared after the request to use it:
I've added a unit test and opened ticket:150 for this issue.
This is now fixed in svn:3156.
Matt