Re: Proposal for aggregation vs. MI
| From: | Lauri Liinat | Date: | Wed, 10 Apr 2002 22:15:18 +0000 |
| Subject: | Re: Proposal for aggregation vs. MI | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-82525@lists.php.net to get a copy of this message | ||
i'll try to answer both Marcus and Wez here:
> Where is the big difference (first is postfix syntax, second is prefix syntax).
the difference is between whether you have to change *lots* of existing code
or do exactly *one* cast in new code while you write it:
$timer = (Timer) $MI_obj;
library_call_1 ($timer);
library_call_2 ($timer);
library_call_3 ($timer);
etc...
what i am proposing here is that the cast would "stick" when object
references are passed around or assigned to. the reference $var would
implicitly "remember" the class it has been cast up to. reasonable enough?
> And as we have no typesystem we cannot use typecasting but another solution.
no typesystem huh? we do have classes, right? so we do have a
typesystem, and just because a variable's type is hidden from the
programmer most of the time doesn't mean it isn't there. btw, PHP
already has the (new_type)$var cast syntax - you can do $var = (int)$var
for example. so we wouldn't really be adding a new construct, but rather
extending an existing one.
so, Wez - why would you want to introduce yet another
cast operator - the "as" keyword? while PHP already has
adopted the C-style (new_type)... operator?
lauri