Re: int context ?

2006-04-11 Thread Larry Wall
On Tue, Apr 11, 2006 at 03:49:45AM +0200, herbert breunung wrote:
: hello perlisticers
: 
: (my first post)
: i read in the perl6 book second edition something called
: 
: /Integer context/ and /Numeric context/
: 
: Ican understand the difference but since nowhere in the synopses i read 
: a word abou integer context im not
: shore if these concept is thrown away. is it the case.

Integer context is still specified by int(x()) (or by passing to any
parameter defined as integer), but whether x() can see that context as
distinct from numeric context is open to debate.  It certainly can't
see any context reliably if you go indirect through an assignment:

my $x = x();# whatever context
int($x);

: i thought that operations like shifting that can anly aplied to integer 
: may be here in some danger to rethought.

Operations like shifting will naturally coerce to integer if you
hand them a Num, presuming the thing being shifted can be so coerced.
Either that, or the shift operation on a Num just multiplies by some
power of 2, perhaps simply by adding or subtracting from the exponent.
(Except that wouldn't truncate the fractional part immediately like
an integer shift would.  But if you then used it as an integer,
it would truncate it, so maybe that's okay...)

Larry


int context ?

2006-04-10 Thread herbert breunung

hello perlisticers

(my first post)
i read in the perl6 book second edition something called

/Integer context/ and /Numeric context/

Ican understand the difference but since nowhere in the synopses i read 
a word abou integer context im not

shore if these concept is thrown away. is it the case.

i thought that operations like shifting that can anly aplied to integer 
may be here in some danger to rethought.


your loyal follower
sir lichtkind