develooper Front page | perl.perl6.language | Postings from September 2008

Re: How to define a new value type?

Thread Previous | Thread Next
From:
John M. Dlugosz
Date:
September 14, 2008 17:33
Subject:
Re: How to define a new value type?
Message ID:
18691-93857@sneakemail.com
TSa (Thomas Sandlaß) thomas-at-sandlass.de |Perl 6| wrote:
> I think a straight forward approach is to overload the
> assignment operator on the actual types of the lhs and
> rhs. The dispatch target than clones the value to be stored
> in the lhs container after being checked against the
> container's constraint.
>
> Regards, TSa.
>   

Since infix:<=> is an operator called on the value of the 
left-hand-side, the semantics are naturally value semantics, as in C++.  
It would be difficult to write it otherwise: take the LHS by ref and 
call STORE on the container.



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