From: Lloyd Zusman Date: 2004-07-30T23:31:50+09:00 Subject: Forward references? Is there a way to define forward references to functions? Due to my own personal eccentricities, I like to have the main body of a program appear at the top of its source file, and the functions it uses at the end. By "define forward reference", I mean something analogous to the following C construct: static char* foo(); /* forward reference */ static char* bar(); /* forward reference */ main () { printf("%s\n", foo()); printf("%s\n", bar()); exit(0); } char* foo() { return ("foo"); } char* bar() { return ("bar"); } If I could make use of forward references in ruby, the above program could look something like this: # somehow, define a forward reference to function foo() # somehow, define a forward reference to function bar() # program starts here x = foo() y = bar() puts x puts y exit(0) # real function definitions ... def foo return "foo" end def bar return "bar" end Am I totally out of luck, or is there some kind of ruby trick I can perform which will give me this capability? Thanks in advance. -- Lloyd Zusman ljz@asfast.com God bless you.