Re: Some questions about using NaN and Inf

2007-10-07 Thread brian d foy
In article <[EMAIL PROTECTED]>, Darren Duncan
<[EMAIL PROTECTED]> wrote:

> At 3:20 PM -0500 10/6/07, brian d foy wrote:
> >For comparisons, how are we going to use Inf and NaN? Are those going
> >to be special flyweight objects, so:
> >
> >$x = 1 / 0;
> >   
> >$x == Inf;# is it the same value
> >$x === Inf;  # it is always the same object

> them.  By contrast, the =:= operator always tests if 2 things are the 
> same object or not, even for those of value types.

Maybe the belongs in "Comparison types" in S02 too :)

So, then, back to the question. People don't care how it's implemented
(and it would be great if we didn't have to explain it). What's the
idiom for the comparison going to be?


Re: Some questions about using NaN and Inf

2007-10-07 Thread brian d foy
In article <[EMAIL PROTECTED]>, Moritz Lenz
<[EMAIL PROTECTED]> wrote:

> brian d foy wrote:
> > * If I can match $x to NaN (or its stand-in), what happens when $x is
> > undef? 
> 
> undef is a property of the container variable (that it holds no value),
> whereas NaN is a property of the content (like 1/0). so undef ~~ NaN
> should be false IMHO.

That's fine, but the question people are going to ask is "if undef
isn't a number, why doesn't iot match 'not a number'". If it doesn't
match, we have to talk about internals to explain it, which is
generlaly not a good idea for beginners :)


Re: Pair notation for number radix

2007-10-07 Thread David Green

On 10/6/07, brian d foy wrote:

That looks like it might mean that these are corresponding forms:
   8 => 377:8<377>:8(377)

Now, if I can do that, what happens to the pair form in a hash composer
when I want the key of '8' and the value of :10<377>?


What happened to the suggestion of using ` to designate units?  Bases 
are a kind of unit (sort of -- counting the number of 10's or 2's or 
16's), so if the colon-form is ambiguous, perhaps it could be 
20`16==32`10?




-David


Re: Indirect objects, adverbial arguments and whitespace

2007-10-07 Thread Luke Palmer
On 10/7/07, Mark J. Reed <[EMAIL PROTECTED]> wrote:
> I would argue for disallowing the all-jammed-together case, lest we
> run into longest-match arguments where "foobar:baz" is "foobar: baz"
> but "foo:barbaz" is "foo :barbaz".  Yuck.

Uh, that doesn't make sense.  Longest match arguments are leftmost, so
if you consider the indirect object : to be part of the variable
before it (I wouldn't), then you would always get the "foobar: baz" /
"foo: barbaz" interpretation.

I don't know about the all jammed together case, but mangle $foo : a
is not ambiguous because : a is not a pair: there is no whitespace
allowed between the colon and the name on that style of pair.

Luke


Re: Indirect objects, adverbial arguments and whitespace

2007-10-07 Thread Mark J. Reed
Visually, I interpret ":a" as a token unto itself, though that's
probably Ruby's fault.  That interpretation would man that the
dual-whitespace version would have to be an indirect object.

I would argue for disallowing the all-jammed-together case, lest we
run into longest-match arguments where "foobar:baz" is "foobar: baz"
but "foo:barbaz" is "foo :barbaz".  Yuck.


On 7 Oct 2007 12:22:56 -, Markus Laker
<[EMAIL PROTECTED]> wrote:
> If I've got this right:
>
> mangle $foo :a;# mangle($foo, a => 1);
> mangle $foo: a;# $foo.mangle(a());
>
> So these --
>
> mangle $foo:a;
> mangle $foo : a;
>
> are ambiguous and, as far as I can tell from the synopses, undefined.  So
> what's the rule: that indirect-object colon needs whitespace after but not
> before, and adverbial colon needs whitespace before but not after?
>
> The reason I ask is that I'm knocking up an intro to Perl 6 for C and C++
> programmers.  I expect some of Perl 6's whitespace rules to trip up people
> used to C++ (as they have me, in my clumsy attempts with Pugs), and I'd
> like to summarise all the whitespace dwimmery in one place.
>
> Many thanks,
>
> Markus
>


-- 
Mark J. Reed <[EMAIL PROTECTED]>


Indirect objects, adverbial arguments and whitespace

2007-10-07 Thread Markus Laker
If I've got this right:

mangle $foo :a;# mangle($foo, a => 1);
mangle $foo: a;# $foo.mangle(a());

So these --

mangle $foo:a;
mangle $foo : a;

are ambiguous and, as far as I can tell from the synopses, undefined.  So
what's the rule: that indirect-object colon needs whitespace after but not
before, and adverbial colon needs whitespace before but not after?

The reason I ask is that I'm knocking up an intro to Perl 6 for C and C++
programmers.  I expect some of Perl 6's whitespace rules to trip up people
used to C++ (as they have me, in my clumsy attempts with Pugs), and I'd
like to summarise all the whitespace dwimmery in one place.

Many thanks,

Markus