Re: where is my mistake

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

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.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu