[svn:perl6-synopsis] r8645 - doc/trunk/design/syn

2006-04-11 Thread larry
Author: larry
Date: Mon Apr 10 21:39:58 2006
New Revision: 8645

Modified:
   doc/trunk/design/syn/S02.pod

Log:
Outlawed 42. (but inlawed .42)


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon Apr 10 21:39:58 2006
@@ -215,8 +215,8 @@
 of it is always considered a method call on C$_ where a term is
 expected.  If a term is not expected at this point, it is a syntax
 error.  (Unless, of course, there is an infix operator of that name
-beginning with dot.  You could, for instance, define a Fortranly C
-infix:.EQ.  if the fit took you.  But you'll have to be sure to
+beginning with dot.  You could, for instance, define a Fortranly
+C infix:.EQ.  if the fit took you.  But you'll have to be sure to
 always put whitespace in front of it, or it would be interpreted as
 a postfix method call instead.)
 
@@ -244,6 +244,15 @@
 
 if you mean the postfix method call.
 
+One consequence of all this is that you may no longer write a Num as
+C42. with just a trailing dot.  You must instead say either C42
+or C42.0.  In other words, a dot following a number can only be a
+decimal point if the following character is a digit.  Otherwise the
+postfix dot will be taken to be the start of some kind of method call
+syntax, whether long-dotty or not.  (The C.123 form with a leading
+dot is still allowed however when a term is expected, and is equivalent
+to C0.123.)
+
 =back
 
 =head1 Built-In Data Types


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


foo..bar or long dot and the range operator

2006-04-11 Thread TSa

HaloO,

I'm unsure what the outcome of the recent long dot discussions is
as far as the range operator is concerned. Since the whole point
of the long dot is to support alignment styles the following cases
shouldn't mean different things:

   foobar #0  single call to foobar (OK, that is different)
   foo.bar#1  method .bar on retval of foo
   foo..bar   #2  range from retval of foo to retval of bar?
   foo. .bar  #3  same as #1

   $x++   #0
   $x.++  #1
   $x..++ #2  or: $x. ++?
   $x. .++#3

   foo()  #0
   foo.() #1
   foo..()#2
   foo. .()   #3

Are all the #2 cases valid syntax? Does the range operator
need whitespace then? Or is there a hole for spacing level 2?

BTW, the above dot sequences let the successions of long dots
look like a wedge, so there are some merits in the idea.
But isn't forced whitespace on the range too high a price?
--


Re: foo..bar or long dot and the range operator

2006-04-11 Thread Larry Wall
On Tue, Apr 11, 2006 at 12:41:30PM +0200, TSa wrote:
: I'm unsure what the outcome of the recent long dot discussions is
: as far as the range operator is concerned.

.. is always the range operator.  The dot wedge just has a discontinuity
in it there.  I can't think of any wedgey applications that wouldn't work
about as well by starting the wedge with $x. .y instead of $x.y.

Larry


placeholder vs. lexical variables

2006-04-11 Thread Dan Kogai

Folks,

I found this when I was playing w/ pugs.

pugs { $^x }.(42)
42
pugs { my $z; $^x }.(42)
*** Undeclared variable: $^x
at interactive line 1, column 10-14

So far as I see s06, there's nothing wrong w/ the statement above.  I  
just want to make sure this is not a perl6 feature.


I found this when I tried

  { my %n; { %n{ $^n } ||= ($^n = 2 ?? 1 !!  ?BLOCK($^n-1) +  ? 
BLOCK($^n-2)) }.($^n) }.(42)


This fails on pugs while

  - $n { my %n; { %n{ $^n } ||= ($^n = 2 ?? 1 !!  ?BLOCK($^n-1)  
+  ?BLOCK($^n-2)) }.($n) }.(42)


beautifully returns 267914296.

Dan the Yet Another Pugs Addict