Re: Why use routine_id?

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

Let's say you have 2 fuctions, foo() and bar().
However, foo() is part of a library, and bar() will be created by the user (such
as in
win32lib), and foo() must call bar(), but bar has not beened defined yet!

integer bar_id
    bar_id = 0

function foo( integer bar_id )

    -- we need to call bar
    call_proc( bar_id, {} )

end function


function bar()

    -- this function is designed by the user

end function
bar_id = routine_id("bar")


The main idea here is functionality. Since we have no GOTO command, nor line
numbers or names to
jump to, we sometimes need to be able to break the natual order of the program.
routine_id()
allows you to do that rather easily. Also, routine_id() allows you to call a
routine if you have
no idea what its name is. Just use Win32Lib and you'll understand...

~Greg

----- Original Message -----
From: Liu Junfeng <rufi at 163.com>
To: EUforum <EUforum at topica.com>
Sent: Thursday, March 20, 2003 10:34 PM
Subject: Why use routine_id?



When define a function or procedure, its name is also given.
It's better to refer to the routine name directly.

My favorite languages:
C#, Euphoria, Haskell, Curry



TOPICA - Start your own email discussion group. FREE!

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

Search



Quick Links

User menu

Not signed in.

Misc Menu