develooper Front page | perl.perl6.language | Postings from March 2005

Re: Adding linear interpolation to an array

Thread Previous | Thread Next
March 11, 2005 10:45
Re: Adding linear interpolation to an array
Message ID:
Larry Wall skribis 2005-03-11  8:45 (-0800):
> On Fri, Mar 11, 2005 at 03:58:13PM +0100, Thomas Sandlaß wrote:
> : Int @i;
> : Num @n = @i; # type error?
> I think the naive user is going to expect that to work, and I also
> suspect the naive user is right to expect it, because it makes sense.
> This may be one of those areas where we can successfully hide the
> high-falutin' theory from mere mortals simply because it maps onto
> what they expect already.

It'd be great if this were a standard feature you can also use for your
own objects.

I believe $foo.Num in this case should return the Num-ified version of
$foo. And maybe the int method numbers have is redundant, and should
be spelled Int instead. Or, well, if this is the case, int should return
an int (not Int) for consistency.

Maybe +$foo even maps to $foo.Num, and ~$foo maps to $foo.Str and ?$foo
maps to $foo.Bool?

Hm, are charsets representable as classes/roles?

my Str::utf8   $bar = ...;
my Str::latin1 $foo = $bar;


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About