develooper Front page | perl.perl6.language.objects | Postings from September 2000

Re: RFC 171 (v2) my Dog $spot should call a constructor implicitly

From:
Hildo Biersma
Date:
September 1, 2000 00:31
Subject:
Re: RFC 171 (v2) my Dog $spot should call a constructor implicitly
Message ID:
39AF5B45.6005B118@msdw.com
Perl6 RFC Librarian wrote:
>> =head1 DESCRIPTION
> 
> What is currently an optimization for pseudo-hashes:
> 
>     my Dog $spot = Dog->new();
> 
> should be replaced with:
> 
>     my Dog $spot;
> 
> which calls an implicit constructor (discussed further in the IMPLEMENTATION
> section).  The optimization behaviour can be retained in some form (see the
> MIGRATION section).

My previous concerns have not been adressed:
- There may not be a default constructor
- This makes creations of Singleton classes impossible
- There is a good reason to created typed, but undef, references
  and fill them in later.

> For example, the syntax:
> 
>     my Dog $spot = "Spot";
> 
> would be transformed to, or be the equivalent of:
> 
>     $spot = Dog->$METHOD("Spot");

Based on my C++ experience, this should only be allowed if the
constructor has been marked as 'implicit construction safe'.

Hildo



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About