Re: Declaring a Function Before it is used

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

I would like to see a C-style rule: you must declare a routine before using
it, but can define it later (must be in the same source file--this would
eliminate the proliferation of headers and be simpler for the interpreter).

I would suggest "declare" as a new keyword, used as below:

declare function foo(3) -- the digit is the number of parameters

declare global procedure bar(0)

declare type blech -- digit not needed, as a type must have exactly one
parameter. But "declare type blech(1)" might be prefered for consistency.

While this is more involved than the VB approach, it would allow Eu to
remain a one-pass interpreter, but eliminate the need for routine_id for
this very common case.

I would also keep routine_id functioning as it does now, we need it for
other things: indirect calls, polymorphic calls, etc.

-- Mike Nelson

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

Search



Quick Links

User menu

Not signed in.

Misc Menu