1. where is my mistake
- Posted by jacques deschênes <desja at gl?betrotter?net> Aug 08, 2007
- 484 views
Why this code doesn't work. Is this an error in my code or because identifiers are unknown at runtime.
-- msg.e procedure msg_print(sequence this) puts(1,this[2]) end procedure integer rid_msg_print --rid_msg_print=routine_id("msg_print") global function new_message(sequence msg) return {routine_id("rid_msg_print"),msg} end function
-- test_msg.exw include msg.e sequence msg msg = new_message("bonjour chez-vous\n") call_proc(msg[1],{msg})
running test_msg.exw result in: test_msg.exw:6 invalid routine id --> See ex.err Jacques Deschênes
2. Re: where is my mistake
- Posted by Pete Lomax <petelomax at blueyon?er.co?uk> Aug 08, 2007
- 468 views
jacques deschênes wrote: > > Why this code doesn't work. > > }}} <eucode> > procedure msg_print(sequence this) > return {routine_id("rid_msg_print"),msg} > </eucode> {{{ Delete the "rid_" from the start of the routine name passed to routine_id Regards, Pete
3. Re: where is my mistake
- Posted by Jason Gade <jaygade at yahoo.?om> Aug 08, 2007
- 482 views
jacques deschênes wrote: > > > Why this code doesn't work. Is this an error in my code or because identifiers > are unknown at runtime. > > > }}} <eucode> > -- msg.e > procedure msg_print(sequence this) > puts(1,this[2]) > end procedure > > integer rid_msg_print > --rid_msg_print=routine_id("msg_print") > > global function new_message(sequence msg) > return {routine_id("rid_msg_print"),msg} > end function > > </eucode> {{{ > > }}} <eucode> > -- test_msg.exw > include msg.e > > sequence msg > msg = new_message("bonjour chez-vous\n") > > call_proc(msg[1],{msg}) > > </eucode> {{{ > > running test_msg.exw result in: > > test_msg.exw:6 > invalid routine id > > --> See ex.err > > > Jacques Deschênes Interesting bug... or undocumented feature. I've verified it on Windows by uncommenting and returning rid_msg_print and it works. Returning a routine_id directly from a return statement doesn't seem to work. -- "Any programming problem can be solved by adding a level of indirection." --anonymous "Any performance problem can be solved by removing a level of indirection." --M. Haertel "Premature optimization is the root of all evil in programming." --C.A.R. Hoare j.
4. Re: where is my mistake
- Posted by Jason Gade <jaygade at y?hoo.co?> Aug 08, 2007
- 478 views
Pete Lomax wrote: > > jacques deschênes wrote: > > > > Why this code doesn't work. > > > > }}} <eucode> > > procedure msg_print(sequence this) > > return {routine_id("rid_msg_print"),msg} > > </eucode> {{{ > Delete the "rid_" from the start of the routine name passed to routine_id > > Regards, > Pete D'oh! I even read this before replying. It works if you do this. -- "Any programming problem can be solved by adding a level of indirection." --anonymous "Any performance problem can be solved by removing a level of indirection." --M. Haertel "Premature optimization is the root of all evil in programming." --C.A.R. Hoare j.
5. Re: where is my mistake
- Posted by jacques deschênes <desja at globetrotte?.?et> Aug 08, 2007
- 469 views
Thanks Pete, At first I did use rid_msg_print variable then I decided to modify the code to call routine_id from inside new_message() but forgot to remove the rid_ prefix. Sometimes we are blind to obvious mistake. regards, Jacques Deschênes Pete Lomax wrote: > > jacques deschênes wrote: > > > > Why this code doesn't work. > > > > }}} <eucode> > > procedure msg_print(sequence this) > > return {routine_id("rid_msg_print"),msg} > > </eucode> {{{ > Delete the "rid_" from the start of the routine name passed to routine_id > > Regards, > Pete