MonkeeSage
12/7/2007 2:25:00 PM
On Dec 7, 8:12 am, "Just Another Victim of the Ambient Morality"
<ihates...@hotmail.com> wrote:
> "MonkeeSage" <MonkeeS...@gmail.com> wrote in message
>
> news:22168293-d632-4314-aa6c-45d50baa1a75@i29g2000prf.googlegroups.com...
>
>
>
> > On Dec 6, 10:16 pm, araminska <n...@nowhere.com> wrote:
> >> > Ruby, like Perl, reads the code line by line, the same as you write
> >> > it..
>
> >> Sorry, but I have to disagree. (That is, if you are saying that Perl has
> >> to have the subs first, also. Not sure you are.)
>
> >> With perl
>
> >> print_form()
>
> >> sub print_form {
> >> #... do stuff
>
> >> }
>
> >> works just fine. I have always put the subs at the bottom and the
> >> calling
> >> code at the top.
>
> >> But you are right and I was wrong about Ruby. Methods DO have to be
> >> defined before use. Not sure what I did before to think they don't.
> >> Perl
> >> and Ruby obviously have different compiling structures.
>
> >> No biggie. I just have to remember that till it becomes natural.
>
> >> Araminska
>
> > Seems that perl parses the entire file first, before it runs any code.
> > In most interpreted languages (ruby, python, lua, javascript, php,
> > &c), the code is executed as soon as an expression is parsed, so it is
> > an error to call a function before you define it.
>
> This is interesting 'cause Python is "compiled at runtime" (as Lee
> Jarvis put it) and, yet, it shares the same limitation of needing
> definitions before use as Ruby...
I'm not actually sure how python does it. I thought I had read a
thread on c.l.p a while ago that said it was compiled on the fly, but
I couldn't find it, so I just asked again over there.
Regards,
Jordan