in reply to Static checking
But in the following (probably bad) C++ code, the function can be looked up just once at compile time, because the function knows what type of object 'thing' will be:sub foo{ my $thing = shift; print $thing->to_xml; }
Yet another layer is added when you use overloading. Let's say that a variable is used in a concatenation, perl must first determine what if any class of object that variable belongs to. If the variable does belong to a class it must determine if that class has the concatentation operator overloaded, if it does then in must determine if the subroutine exists that it is overloaded with, and then it calls that subroutine. In a static typed language this only has to be done once at compile time.void foo(bar thing){ cout << thing.to_xml(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Static checking
by hardburn (Abbot) on Nov 05, 2003 at 17:17 UTC |