develooper Front page | perl.perl6.users | Postings from July 2021

Re: Why does .new initialize?

Thread Previous | Thread Next
From:
Peter Scott
Date:
July 19, 2021 17:09
Subject:
Re: Why does .new initialize?
Message ID:
f603ef9c-f0df-8533-4711-bb2fb7d5f77c@PSDT.com
Yes.  I'm agnostic on this point, but there was a time when some 
prominent Perl contributors were dogmatic about it and I didn't know how 
widespread it was.

Peter

On 7/19/2021 10:06 AM, Vadim Belman wrote:
>
> Let me guess. The school prohibits object self-initialization? It has 
> to be done by external code?
>
> Best regards,
> Vadim Belman
>
>> On Jul 19, 2021, at 1:00 PM, Peter Scott <peter@psdt.com 
>> <mailto:peter@psdt.com>> wrote:
>>
>> On 7/19/2021 1:24 AM, Elizabeth Mattijsen wrote:
>>> If .new wouldn't initialize a type to its basic instantiation, what 
>>> would be the point of .new then?
>>>
>>> FWIW, the same goes for:
>>>
>>>     dd Int.new;      # 0
>>>     dd Num.new;      # 0e0
>>>     dd Complex.new;  # <0+0i>
>>>     dd Str.new;      # ""
>>>
>>> If you want to leave it undefined, don't call .new on it?
>>>
>>> *confused*
>>
>> Only that there's a vocal school of thought in O-O that says new() 
>> should only allocate memory and never put anything in there.  Now I 
>> know that Raku doesn't subscribe to that I have no problem.
>>
>> Cheers,
>> Peter
>


Thread Previous | Thread Next


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