Re: Prothon in Prothon (blue sky :-)

"Mark Hahn" <[email protected]> Tue, 4 May 2004 12:01:53 -0700
Newsgroups gmane.comp.lang.prothon.devel
Message-ID <[email protected]>
Joe Knapka wrote:

> What I mean is, when you see
>
> z = a + 3
>
> in a Prothon program, there's no fundamental reason that can't
> turn into
>
>   mov ax,[addr_of_data_field_in_a_object]
>   add ax,3
>   mov [addr_of_data_field_in_z_object],ax

Yes, there is a fundamental reason.  The variable "a" can be rebound to a
totally different object by any other code at any time making that compiled
code totally wrong.  This can't happen in a static language with "a"
hard-wired to a static location in memory.  That is what I meant by there
being a large overhead of code that needs to run at all times whether it's
method overloading or variable binding.

Compilers can do some analysis, both static and dynamic, to find out whether
"a" ever changes for example, but that is very complex and the results are
limited in dynamic languages.  Think about Python and the exec statement on
a calculated string for a moment.  That blows away any optimization.

P.S. This should be in prothon-user, not prothon-dev.  User is for future
ideas, dev is for current development.  I've been copying it over there.