Larry Wall writes:
> The default / operator is not going to do integer division.
Yay!
> This is not negotiable;
Double-yay!
> Whether a Num that happens to be an integer prints out with .0 is a
> separate issue. My bias is that a Num pretend to be an integer when
> it can.
Triple-yay!
Smyle
At 5:56 PM -0800 1/22/07, Larry Wall wrote:
Whether a Num that happens to be an integer prints out with .0 is a
separate issue. My bias is that a Num pretend to be an integer when
it can. I think most folks (including mathematicians) think that
the integer 1 and the distance from 0 to 1 on the
The default / operator is not going to do integer division. This is
not negotiable; normal people expect 1/2 to mean one half, so / is
going to coerce to some type that can support fractions. We'll use
"div" and "mod" for the polymorphic variants defaulting to floor
semantics, and things like edi
Doug McNutt wrote:
At 00:32 + 1/23/07, Smylers wrote:
% perl -wle 'print 99 / 2'
49.5
I would expect the line to return 49 because you surely meant integer
> division. Perl 5 just doesn't have a user-available type integer.
I'd find that somewhat unhelpful. Especially on a one-liner, l
At 12:32 AM + 1/23/07, Smylers wrote:
Darren Duncan writes:
For round-trip consistency, a generic non-formatted num-to-char-string
operation should include a .0 as appropriate if it is converting from
a Num, whereas when converting from an Int it would not.
So this (in Perl 5):
% pe
At 00:32 + 1/23/07, Smylers wrote:
> % perl -wle 'print 99 / 2'
> 49.5
I would expect the line to return 49 because you surely meant integer division.
Perl 5 just doesn't have a user-available type integer.
% perl -wle 'print 99.0 / 2.0' OR
% perl -wle 'print 99.0 / 2'
would return 49.5
Author: larry
Date: Mon Jan 22 17:53:44 2007
New Revision: 13537
Modified:
doc/trunk/design/syn/S04.pod
Log:
Forgot that we're calling them multislices these days...
Modified: doc/trunk/design/syn/S04.pod
==
--- doc/
Author: larry
Date: Mon Jan 22 17:46:46 2007
New Revision: 13536
Modified:
doc/trunk/design/syn/S03.pod
Log:
Debrainoization suggested by John Macdonald++.
Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/desi
Darren Duncan writes:
> For round-trip consistency, a generic non-formatted num-to-char-string
> operation should include a .0 as appropriate if it is converting from
> a Num, whereas when converting from an Int it would not.
So this (in Perl 5):
% perl -wle 'print 100 / 2'
50
you would wan
At 10:03 AM -0800 1/17/07, Jonathan Lang wrote:
TSa wrote:
Luke Palmer wrote:
That is, is 1 different from 1.0?
I opt for 1 being Int and 1.0 being Num. But for the
latter a test .does(Int) might succeed on the footing
that the fractional part is zero, that is 1.0%1 == 0.
I'm very leery of
Author: larry
Date: Mon Jan 22 15:51:04 2007
New Revision: 13535
Modified:
doc/trunk/design/syn/S04.pod
Log:
typo from thom++
Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(origina
Author: larry
Date: Mon Jan 22 12:21:27 2007
New Revision: 13534
Modified:
doc/trunk/design/syn/S03.pod
Log:
Tweakage of && and || semantics in support of list comprehensions.
Modified: doc/trunk/design/syn/S03.pod
=
Author: larry
Date: Mon Jan 22 11:47:39 2007
New Revision: 13533
Modified:
doc/trunk/design/syn/S04.pod
Log:
typo from TreyHarris++
Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(o
Author: larry
Date: Mon Jan 22 11:40:24 2007
New Revision: 13532
Modified:
doc/trunk/design/syn/S04.pod
Log:
More list comprehension tweakage.
Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.po
Author: larry
Date: Mon Jan 22 10:46:25 2007
New Revision: 13531
Modified:
doc/trunk/design/syn/S04.pod
Log:
Implicit return policies clarified. Loop and conditional returns are now
more conducive to list comprehension constructs (including accidental ones).
Modified: doc/trunk/design/syn/S
Sorry some zealous re-factoring screwed my earlier script. The objects
should have been created outside the push stack. I.e.
my $a = MyObj->new('zippy', 3);
my $b = MyObj->new('biggles', 5);
my $s = new Thread::Semaphore;
my @B :shared;
push @B, $a;
push @B, $b;
...
Then the destruction does
Actually this script displays: -
Creating 'zippy' with 3 lives
Destroying 'zippy' with 3 lives
Creating 'biggles' with 5 lives
Destroying 'biggles' with 5 lives
T1: starting
T1: 'biggles' has 5 lives
T1: Remove from list
T2: starting
T2: 'biggles' has 4 lives
T2: Remove from list
T3: starting
T3:
Here is a script in Perl 5 with a multi-threaded RAII idiom I use quite
a lot (In P5 & C++). I am not sure how threads will be implemented in P6
(but hopefully one will have a *choice* of copying all variables into
your private namespace!).Will the LEAVE closure trait take the previous
role of
18 matches
Mail list logo