Could someone who knows enlighten me, please?
Luke
Well, perhaps I'm mistaken, but I had understood it to mean simply
that the binding between variables and/or methods is established at
compile time, not at runtime. Specifically:
- Named variables have their addresses hardcoded during compilation
- Global variables given offset from start of global data area
- Local variables given offset from top of stack
- Object variables given offset from start of object data
- Normal function and method calls are hardcoded during compilation
- Normal functions have specific starting address in object file
- Object methods have specific starting address in object file
- Compiler is able to determine which function matches each call
(The above shamelessly cribbed from:
http://www.cs.sbcc.net/~shouk/polyhi/tsld005.htm, because it's 9:34 AM
and my brain doesn't wake up for at least another half hour.)
-Dks
(Responding to my own post) I suppose I should explicitly state that
P6 will probably implement things a little differently from the
details described above (e.g., I don't know that we will have
one-and-only one global data area), but the above describes the
general concept.
--Dks
> what's compile-time binding?
A normal binding:
$name := expr;
is a run-time operation that installs its RHS operand as a new implementation
for the LHS symbol. That is, it means:
$CurrentPackage::{'$name'} = \(expr)
(with some special magic that only enreferences C<expr> if it's not already a
reference to a scalar).
A compile-time binding:
$name ::= expr;
*pre*-installs its RHS operand as an implementation for the LHS symbol. That
is, it means:
BEGIN { $CurrentPackage::{'$name'} = \(expr) }
(with the same special enreferencing magic).
In other words, C<::=> is to C<:=> as a macro call is to a subroutine call.
Damian