On Fri, Sep 01, 2000 at 05:23:27PM +0200, Slaven Rezic wrote:
> Often, there is the case that "my" is used before actually assigning a
> value to it. For example:
> 
>     my Foo $foo;
>     if ($cond1) {
>       $foo = new Foo 1, 2, 3;
>     } else {
>       $foo = new Foo 2, 4, 6;
>     }
> 
> If we have implicit constructors, will this cause unnecessary
> overhead, that is, calling the implicit constructor and then the real
> one?

Yes, so don't do that.  If you want optimization, I've been suggesting my
$spot : isa(Dog) (actually, I've been suggesting my $spot isa(Dog), which
was a typo):

my $foo : isa(Dog);
if ($cond1) {
    $foo = new Foo 1, 2, 3;
} else {
    $foo = new Foo 2, 4, 6;
}


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

Reply via email to