Ph. Marek philipp.marek-at-bmlv.gv.at |Perl 6| wrote:
I think that's a can of work, and I'd be +1 on TSa:
If the programmer really wants to decrement "10" to "09" she has
to cast that to Str: ("10" as Str)--. So we have "10".HOW === Str
but "10".WHAT === Num Str.
It's behaving as Num
HaloO,
Larry Wall wrote:
On the other hand, "09" has the advantage of still having the numeric
value 9.
Well, I think the canonical representation of of 9 is "9". The mapping
of numeric strings to numbers is N to 1. Is it defined that non-numeric
strings map to NaN or to zero?
But the conv
HaloO,
John M. Dlugosz wrote:
If the programmer really wants to decrement "10" to "09" she has to
cast that to Str: ("10" as Str)--. So we have "10".HOW === Str
but "10".WHAT === Num Str.
It's behaving as Num ∪ Str, while the declaration Num Str in
juxtaposition means Num ∩ Str.
Hmm? I
On Thu, Apr 24, 2008 at 09:15:15PM +0200, TSa wrote:
> I had hoped that WHAT denotes a more specific type than HOW. E.g.
>
>subset ThreeChars of Str where {$_.elems == 3}
>
>my ThreeChars $x = 'xxx';
>
>$x.WHAT; # ThreeChars
>$x.HOW; # Str
>
>$x === 'xxx'; # false because typ
HaloO,
Larry Wall wrote:
You are confusing the container with the object. .WHAT and .HOW are
both dynamically typed, and $x.WHAT returns Str, because objects do
not carry subtypes. The container enforces the ThreeChars constraint,
but does not require a ThreeChars object.
Thanks for helping
On Thu, Apr 24, 2008 at 08:10:12PM +0200, TSa wrote:
> HaloO,
>
> Larry Wall wrote:
>> On the other hand, "09" has the advantage of still having the numeric
>> value 9.
>
> Well, I think the canonical representation of of 9 is "9". The mapping
> of numeric strings to numbers is N to 1. Is it define
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote:
... Is it defined that non-numeric
strings map to NaN or to zero?
Zero.
But I think in Perl 6 we're leaning more
toward preserving information than Perl 5 did.
This information being the length of the string I presume.
People have been
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote:
Hmm? I meant Num ∩ Str. This intersection type is a subtype of
Str and Num without type coercion and it beats both in specificity
when it comes to dispatch.
There are methods in Str that are not in Num, and vice versa. A
variable declared as Num
Larry Wall larry-at-wall.org |Perl 6| wrote:
Neither, probably. You'd get an undef of type Num. Which might or
might not convert to NaN or 0 under various circumstances.
The orthodox documentation has Failure being undef that throws an
exception if you try and get a value from it. Nothing
On Thu, Apr 24, 2008 at 03:31:52PM -0500, John M. Dlugosz wrote:
> BTW, it will require a new rule in the specification to allow «=« as a
> form of pseudo-assignment to declarations. But it has problems with the
> list on the RHS anyway.
I don't see why, since there's no list there...and anyway
On Thursday 24 April 2008 20:31, John M. Dlugosz wrote:
> That makes me think of another way to confuse people who don't really
> know the difference between numbers and strings:
>
> $x = "-100";
> $x++;
> say $x; # prints -101, not -99.
There's plenty of other ways to confuse people
On Thursday 24 April 2008 23:54, smuj wrote:
> There's plenty of other ways to confuse people too; try $x with "999" or
> "1.23e9" :-)
One can even confuse oneself! Forget the dot in "1.23e9" :-)
Cheers,
smuj
--
smuj
([EMAIL PROTECTED])
On Thursday 24 April 2008 22:09, Larry Wall wrote:
> > That makes me think of another way to confuse people who don't really
> > know the difference between numbers and strings:
> >
> > $x = "-100";
> > $x++;
> > say $x; # prints -101, not -99.
>
> Interesting point. At one time we had t
Larry Wall larry-at-wall.org |Perl 6| wrote:
The initializer needs to go =inside= the
signature. I think you meant to write
(my int8 ($x, $y)) «=« 127;
It should already parse that way. scope_declarator is a noun,
and nouns may be used on the left side of an infix operator. When
smuj smuj-at-iol.ie |Perl 6| wrote:
Do we still get to keep the current semantics if we specificially declare a
string? e.g.
my Str $x = "-100";
$x++;
say $x; # prints -101
my $y = "-100";
$y++;
say $y; # prints -99
Cheers,
smuj
I'd vote for that.
As well as a hand full of adjectives.
15 matches
Mail list logo