r24784 - docs/Perl6/Spec

2009-01-06 Thread pugs-commits
Author: moritz
Date: 2009-01-06 11:14:50 +0100 (Tue, 06 Jan 2009)
New Revision: 24784

Modified:
   docs/Perl6/Spec/S29-functions.pod
Log:
[S29] typos, thinkos and wording improvements, Brandon++, Tim++


Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2009-01-06 01:12:13 UTC (rev 24783)
+++ docs/Perl6/Spec/S29-functions.pod   2009-01-06 10:14:50 UTC (rev 24784)
@@ -202,7 +202,7 @@
  our Str multi method perl (Object $o)
 
 Returns a perlish representation of the object, so that calling C
-on the returned string reproduces the object as good as possible.
+on the returned string reproduces the object as accurately as possible.
 
 =back
 
@@ -224,10 +224,10 @@
 
 =item can
 
- our Bool multi method can ($self:, Str $method)
+ our Callable multi method can ($self:, Str $method)
 
 If there is a multi method of name C<$method> that can be called on
-C<$self>, then closure is return has C<$self> bound to the position
+C<$self>, then a closure is return which has C<$self> bound to the position
 of the invocant.
 
 Otherwise an undefined value is returned.
@@ -237,7 +237,7 @@
  our multi method clone (::T $self --> T)
  our multi method clone (::T $self, *%attributes --> T)
 
-The first variant retuns  an independent copy of C<$o> that is equivlant
+The first variant returns  an independent copy of C<$o> that is equivalent
 to C<$o>.
 
 The second variant does the same, but any named arguments override an
@@ -266,7 +266,7 @@
 
  our Bool multi method isa ($self:, $type)
 
-Returns true if a the invocant an instance of class C<$type>, or 
+Returns C if a the invocant an instance of class C<$type>, or 
 of a subset type or a derived class (through inheritance) of C<$type>.
 
 =back



[perl #62002] Object.perl is not inherited to user-defined classes

2009-01-06 Thread Carl Mäsak
# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #62002]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=62002 >


Due to the structurally recursive nature of C<.perl>, the fact that
Rakudo r34997 doesn't give newly defined classes a default C<.perl>
method upon definition is very keenly felt e.g. when doing C<.perl> on
a list of instances of the new class.

$ perl6 -e '(class {}).new.perl'Method 'perl' not found for invocant of class ''
[...]
$ perl6 -e 'class A {}; A.new.perl'
Method 'perl' not found for invocant of class 'A'
[...]

Two questions naturally arise: the first is why this method isn't
inherited from Object? The second is what such a default C<.perl>
should output.

I have a vague feeling that similar tickets have been submitted
before. But this question needs to be put forward until the spec is
clarified (or whatever is the blocker) -- missing methods is one of
the few things that can ruin a scripting session.


[perl #62006] Strange errors regarding protoobjects

2009-01-06 Thread Carl Mäsak
# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #62006]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=62006 >


Rakudo r34997 exhibits a few problems related to mentioning or
numifying protoobjects.

$ ./perl6 -e 'Match'
Null PMC access in get_integer()
[...]
mbpro-2:perl6 masak$ ./perl6 -e '+Match'
Null PMC access in cmp()
[...]
$ perl6 -e 'class Foo {}; +Foo'
get_number() not implemented in class 'Foo'
[...]

The last one could safely be made to have a default of 0, IMHO. As for
the first two, a Null PMC access is a Parrot implementation detail,
and should ideally never be the output of a Perl 6 program.


[perl #62004] Enum values aren't recognized without their namespace

2009-01-06 Thread Carl Mäsak
# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #62004]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=62004 >


Rakudo r34997 doesn't allow enum values to be written without their namespace:

$ perl6 -e 'enum Color ; my Color $c = Color::white; say $c'
0
$ perl6 -e 'enum Color ; my Color $c = white'too few
arguments passed (0) - 1 params expected
[...]

The hard-coded exception right now is C and C.


Re: [perl #61990] [BUG] setset .WHAT returns incorrect value

2009-01-06 Thread Ovid
- Original Message 

> From: Jonathan Worthington 

> >   subset Even of Int where { not $_ % 2 };
> >   my Even $num = 2;
> >   say $num;
> >   say $num.WHAT;
> > 
> > 
> > Output:
> > 
> >   2
> >   Int
> >  I'm expecting:
> > 
> >   2
> >   Even
> > 
> >  
> I think the current behaviour is correct (or at least, implemented to match 
> my 
> understanding of the Perl 6 type system). You're asking for the type of the 
> value stored in $x, which is an Int.
> 
> Even is not a "real type", but rather a refinement type. It is set as a 
> constraint on what may be held by the container. To get hold of that (though 
> I 
> don't think we implement any way right now) you probably would write 
> $x.VAR.type 
> or some such (I'm not sure exactly what the name of the method on the 
> container 
> that hands this back should be).

Really?  It subset looks to me like a new type definition, built on an existing 
type.  If that was the case, then this would look normal:

  my Int $foo; say $foo.WHAT;  # Int
  my Odd $bar; say $bar.WHAT;  # Odd

 
That *looks* right to me, particularly since what comes after the "my" seems 
like a type declaration.  By your logic, .WHAT refers to the value, not the 
container, which seems odd.  That being said:

  my $foo = 3; say $foo; # Int
  $foo = 'stuff'; say $foo; # Str

So that's probably bad coding (reusing a variable for different types) but it's 
legal.  So maybe this is the correct behavior, but I expect it's going to 
confuse people.

Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog- http://use.perl.org/~Ovid/journal/
Twitter  - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6



[perl #62008] .fmt and ~ on hash values differ by a final newline

2009-01-06 Thread Carl Mäsak
# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #62008]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=62008 >


 rakudo 35017: OUTPUT«1   2␤3  4␤␤»
 rakudo: say {1 => 2, 3 => 4}.fmt("%s\t%s")
 rakudo 35017: OUTPUT«1   2␤3  4␤»
 oy! what with the extra newline in the stringification case?
* masak submits rakudobug
 where is the bug?
 moritz_: it might be considered a bug that the last two results differ.
 so what does "%s\t%s" mean on hash?
 moritz_: key, tab char, value
 masak: and how should they the separated?
 by newlines, that's the default.
 but the operative word is 'separated'
 there shouldn't be a final newline
 (apart from the one that 'say' outputs)


[perl #62012] parses but always returns true

2009-01-06 Thread via RT
# New Ticket Created by  Richard Hainsworth 
# Please include the string:  [perl #62012]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=62012 >


See the following (svn revision 34915)
$ perl6
 > regex digit { [0..9] }; my $x='abc9';my $y='def';$x~~// and 
say 'got digit';$y~~// and say 'not got digit';
got digit
not got digit
 > regex digit { [0..9] }; my $x='abc9';my $y='def';$x~~// and 
say 'got digit';$y~~// and say 'not got digit';
got digit
not got digit
 > regex digit { [0..9] }; my $x='abc9';my $y='def';$x~~// and 
say 'got digit';$y~~// and say 'not got digit';
got digit
 >

The assumption was  is the logical inverse of 

Either way, // is returning true with and without a digit ( $x 
test in first and third lines both give 'got digit').



[perl #62010] [PATCH] fix PARROT_EXPORT visibility=default for gcc other than 4.x

2009-01-06 Thread via RT
# New Ticket Created by  Donald Hunter 
# Please include the string:  [perl #62010]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=62010 >


This patch fixes a problem with gcc 3.4.6 on Linux where -fvisibility=hidden
is detected as supported but __attribute__((visibility("default"))) is not
used for PARROT_EXPORT. The setting for export visibility was hard-coded for
gcc > 4.0 so I changed it to be a new test based on the detection of support
for -fvisibility=hidden

I created a new file for the config step because it has to happen after
config/auto/warnings.pm and there's no other relevant file to put it in.

 config/auto/export.pm |   55
++
 config/auto/gcc.pm|3 --
 lib/Parrot/Configure/Step/List.pm |1
 3 files changed, 56 insertions(+), 3 deletions(-)


gcc_export_visibility.patch
Description: Binary data


opposite of when (fewer stupid errors)

2009-01-06 Thread Richard Hainsworth
Suppose I want a 'when' clause to fire when the test is *not* met. What 
syntax should be used?


So how would I do

my $x = 'abced';
given $x {
  when ! // {say 'this does not contain a digit'} # this does 
not work

}

Since the ~~ operator is implied in the when, how do we get an implied 
!~~ operator?


By analogy with the
if/unless and while/until pairs, perhaps there should be an inverse for 
'when'.


I cant think of an immediate opposite to 'when', but how about
although, yet, except, howbeit

Perhaps (less elegant): when not, elided to 'whent'

English doesnt seem to have a word that fits the opposite of
'when'  
In other words something that would substitute for
'when the following is not true'  



Re: [perl #62002] Object.perl is not inherited to user-defined classes

2009-01-06 Thread Patrick R. Michaud
On Tue, Jan 06, 2009 at 02:50:07AM -0800, Carl Mäsak wrote:
> Due to the structurally recursive nature of C<.perl>, the fact that
> Rakudo r34997 doesn't give newly defined classes a default C<.perl>
> method upon definition is very keenly felt e.g. when doing C<.perl> on
> a list of instances of the new class.
> 
> $ perl6 -e '(class {}).new.perl'Method 'perl' not found for invocant of class 
> ''
> [...]
> $ perl6 -e 'class A {}; A.new.perl'
> Method 'perl' not found for invocant of class 'A'
> [...]
> 
> Two questions naturally arise: the first is why this method isn't
> inherited from Object? The second is what such a default C<.perl>
> should output.

Rakudo doesn't implement a .perl in Object because of the second
question -- we don't know what that default C<.perl> should output.

But if you'd like to add a temporary ".perl" method to Object
that does something more reasonable (however you define it),
that's certainly ok.

In the meantime I'm marking this ticket as a [Spec] ticket.

Pm


Re: [perl #62002] Object.perl is not inherited to user-defined classes

2009-01-06 Thread Carl Mäsak
Pm (>):
> But if you'd like to add a temporary ".perl" method to Object
> that does something more reasonable (however you define it),
> that's certainly ok.

 masak: What about a TheClass.new(...) which sets up attributes
to their current values?
 jnthn: you know, that's actually not half bad. :)
 (why didn't I think of that?)


Re: not wanting something

2009-01-06 Thread Chas. Owens
On Tue, Jan 6, 2009 at 10:12, Patrick R. Michaud  wrote:
snip
> Also, Perl 6 already provides a 'digit' rule by default, although
> it's digits in the Unicode sense as opposed to simply the 0..9
> sequence.
snip

Please tell me that Perl 6 isn't going to make that same error the
Perl 5.8 did.  Or at least tell me that it will provide two classes:
Unicode digit and digit you can do math with.  Unicode digit is nearly
worthless, and people keep confusing it for digit you can do math
with.  Shouldn't the Huffman encoding principle come into play and \d
be reserved for [0-9] and \p{IsDigit} (or the equivalent Perl 6
construct) be used for matching Unicode digits?


-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.


Re: returning one or several values from a routine

2009-01-06 Thread Daniel Ruoso
Em Seg, 2009-01-05 às 20:32 +0100, Moritz Lenz escreveu:
> Daniel Ruoso wrote:
> > would force item context in the capture, and here is the problem, as a
> > capture in item context was supposed to return the invocant.
> Maybe we could have a different rule for captures in scalar contexts
> that don't have an invocant?

I've just realized we were missing some spots, so remaking the list of
possibilities

 my $a = sub s1 { return a => 1 }
 my $b = sub s2 { return a => 1, b => 2 }
 my $c = sub s3 { return 1, 2, 3, a => 1, b => 2 }
 my $d = sub s4 { return 1 }
 my $e = sub s5 { return 1, 2, 3 }
 my $f = sub s6 { return 1: #< it doesnt matter > }
 my $g = sub s7 { return }

But while writing this email, I've realized that a Capture object is
supposed to implement both .[] and .{}, so maybe we can just simplify...

 $g is an undefined Object
 $f is 1
 $d is 1
 $a is a Pair
 everything else is the Capture itself

daniel



Re: returning one or several values from a routine

2009-01-06 Thread Jon Lang
Daniel Ruoso wrote:
> I've just realized we were missing some spots, so remaking the list of
> possibilities
>
>  my $a = sub s1 { return a => 1 }
>  my $b = sub s2 { return a => 1, b => 2 }
>  my $c = sub s3 { return 1, 2, 3, a => 1, b => 2 }
>  my $d = sub s4 { return 1 }
>  my $e = sub s5 { return 1, 2, 3 }
>  my $f = sub s6 { return 1: #< it doesnt matter > }
>  my $g = sub s7 { return }
>
> But while writing this email, I've realized that a Capture object is
> supposed to implement both .[] and .{}, so maybe we can just simplify...

Bear in mind that some list objects can use .{} (for customized
indices) as well as .[] (for standard indices).  As such, $e ought to
get a List rather than a Capture.  And if you're going to go that far,
you might as well go the one extra step and say that $b gets a Hash
rather than a Capture.

But I agree about $a, $c, $d, $f, and $g.

>  $g is an undefined Object
>  $f is 1
>  $d is 1
>  $a is a Pair
>  everything else is the Capture itself

Of course, that's only a third of the problem.  What should people
expect with each of these:

  my @a = sub s1 { return a => 1 }
  my @b = sub s2 { return a => 1, b => 2 }
  my @c = sub s3 { return 1, 2, 3, a => 1, b => 2 }
  my @d = sub s4 { return 1 }
  my @e = sub s5 { return 1, 2, 3 }
  my @f = sub s6 { return 1: }
  my @g = sub s7 { return }

  my %a = sub s1 { return a => 1 }
  my %b = sub s2 { return a => 1, b => 2 }
  my %c = sub s3 { return 'a', 1, 'b', 2, a => 1, b => 2 }
  my %d = sub s4 { return 1 }
  my %e = sub s5 { return 'a', 1, 'b', 2 }
  my %f = sub s6 { return 1: }
  my %g = sub s7 { return }

Should @a == (), or should @a == ( a => 1 )?  Or maybe even @a == ( 'a', 1 )?
Likewise with @b and @f.

Should %e == {} or { a => 1, b => 2 }?

-- 
Jonathan "Dataweaver" Lang


Re: returning one or several values from a routine

2009-01-06 Thread Daniel Ruoso
Em Ter, 2009-01-06 às 11:28 -0800, Jon Lang escreveu:
> Of course, that's only a third of the problem.  What should people
> expect with each of these:

Hmm... I think that takes the discussion to another level, and the
question is:

 "what does a capture returns when coerced to a context it doesn't
provide a value for?"

The easy answer would be undef, empty array and empty hash, but that
doesn't DWIM at all.

The hard answer is DWIM, and that can be:

 1) in item context, without an invocant
   a) if only one positional argument, return it
   b) if only one named argument, return it as a pair
   c) if several positional args, but no named args,
  return an array
   d) if several named args, but no positional args,
  return a hash
   e) if no args at all, return undefined Object
   f) return itself otherwise
 2) in list context, without positional arguments
   a) if one or more named arguments,
  return a list of pairs
   b) return an empty list otherwise
 3) in hash context, without named arguments
   a) if there are positional arguments,
  return a hash taking key,value.
  if an odd number of positional arguments,
  last key has an undef Object as the
  value and issue a warning.
   c) return an empty hash otherwise

daniel



Re: [perl #61942] NaN !~~ NaN in Rakudo

2009-01-06 Thread Moritz Lenz
I now added a test to t/spec/S03-operators/smartmatch.t

Moritz


Re: returning one or several values from a routine

2009-01-06 Thread Jon Lang
Daniel Ruoso wrote:
> Hmm... I think that takes the discussion to another level, and the
> question is:
>
>  "what does a capture returns when coerced to a context it doesn't
> provide a value for?"
>
> The easy answer would be undef, empty array and empty hash, but that
> doesn't DWIM at all.
>
> The hard answer is DWIM, and that can be:
>
>  1) in item context, without an invocant
>   a) if only one positional argument, return it
>   b) if only one named argument, return it as a pair
>   c) if several positional args, but no named args,
>  return an array
>   d) if several named args, but no positional args,
>  return a hash
>   e) if no args at all, return undefined Object
>   f) return itself otherwise
>  2) in list context, without positional arguments
>   a) if one or more named arguments,
>  return a list of pairs
>   b) return an empty list otherwise
>  3) in hash context, without named arguments
>   a) if there are positional arguments,
>  return a hash taking key,value.
>  if an odd number of positional arguments,
>  last key has an undef Object as the
>  value and issue a warning.
>   b) return an empty hash otherwise

Elaborate further to account for the possibility of an invocant.  For
example, if you have a capture object with just an invocant and you're
in list context, should it return the invocant as a one-item list, or
should it return an empty list?  Should hash context of the same
capture object give you a single Pair with an undef value and a a
warning, or should it give you an empty hash?

I don't mind the dwimmery here, even though that means that you can't
be certain that (e.g.) 'list $x' will return the positional parameters
in capture object $x.  If you want to be certain that you're getting
the positional parameters and nothing else, you can say '$x.[]'; if
you want to be certain that you're getting the named parameters, you
can say '$x.{}'.  The only thing lost is the ability to ensure that
you're getting the invocant; and it wouldn't be too hard to define,
say, a postfix:<_> operator for the Capture object that does so:

  item($x) # Dwimmey use of item context.
  list($x) # Dwimmey use of list context.
  hash($x) # Dwimmey use of hash context.
  $x._ # the Capture object's invocant, as an item.
  $x.[] # the Capture object's positional parameters, as a list.
  $x.{} # the Capture object's named parameters, as a hash.

-- 
Jonathan "Dataweaver" Lang


Re: returning one or several values from a routine

2009-01-06 Thread TSa (Thomas Sandlaß)
On Tuesday, 6. January 2009 22:01:36 Jon Lang wrote:
>   item($x) # Dwimmey use of item context.

IIRC this is the same as $$x, right? Or does that
extract the invocant slot without dwimmery?

>   list($x) # Dwimmey use of list context.
>   hash($x) # Dwimmey use of hash context.
>   $x._ # the Capture object's invocant, as an item.

How about $x.() here? That looks symmetric to the other
postfix operators and should be regarded as a method
dispatched on the invocant or some such.

>   $x.[] # the Capture object's positional parameters, as a list.
>   $x.{} # the Capture object's named parameters, as a hash.


Regards, TSa.
-- 
"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12  -- Srinivasa Ramanujan


Re: returning one or several values from a routine

2009-01-06 Thread Jon Lang
TSa wrote:
> Jon Lang wrote:
>>   item($x) # Dwimmey use of item context.
>
> IIRC this is the same as $$x, right? Or does that
> extract the invocant slot without dwimmery?

Umm... good question.  This is a rather nasty paradox: on the one
hand, we want to be able to stack $, @, and % with capture objects in
analogy to Perl 5's references, which would indicate that they should
tie directly to the invocant, positional parameters, and named
parameters, respectively.  OTOH, the intuitive meaning for these
symbols would seem to be "item context", "list context", and "hash
context", respectively, which would argue for the dwimmery.

The question is which of these two sets of semantics should be
emphasized; once that's answered, we need to be sure to provide an
alternative syntax that gives us the other set.  IOW, which one of
these is "make common things easy", and which one is "make uncommon
things possible"?

>>   $x._ # the Capture object's invocant, as an item.
>
> How about $x.() here? That looks symmetric to the other
> postfix operators and should be regarded as a method
> dispatched on the invocant or some such.

Symmetric, but ugly.  I suggested the underscore because '.foo' is the
same as '$_.foo'; so you can think of the invocant of a capture object
as being roughly analogous to a topic.

-- 
Jonathan "Dataweaver" Lang


Re: not wanting something

2009-01-06 Thread Patrick R. Michaud
On Tue, Jan 06, 2009 at 12:42:16PM -0500, Chas. Owens wrote:
> On Tue, Jan 6, 2009 at 10:12, Patrick R. Michaud  wrote:
> snip
> > Also, Perl 6 already provides a 'digit' rule by default, although
> > it's digits in the Unicode sense as opposed to simply the 0..9
> > sequence.
> snip
> 
> Please tell me that Perl 6 isn't going to make that same error the
> Perl 5.8 did.  

As far as I know,  means "Unicode alphabetic", and by analogy
one presumes that  is "Unicode digit".

> Or at least tell me that it will provide two classes:
> Unicode digit and digit you can do math with.  

It's entirely possible that in Perl 6 one can "do math" with
strings containing Unicode digits, making the distinction 
somewhat irrelevant, perhaps.  (I don't have proof of this, but 
I suspect it to be the case.)

I know that magical string autoincrement honors Unicode digit
sequences, at any rate.

Pm


[perl #62024] [TODO]: implement qqx

2009-01-06 Thread via RT
# New Ticket Created by  Moritz Lenz 
# Please include the string:  [perl #62024]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=62024 >


I know that rakudo doesn't prioritize implementation of the various
quoting constructs, but there are various things that need testing
($*OUT.say, @*ARGS (which seems to be broken atm), command line
switches, things like RT #61980) that can't be tested without that
feature, or similar features.

Any way to execute another command and capture the result without too
much pain would enable me to write such tests.

Cheers,
Moritz


[perl #62026] Can't write to to array/hash attributes

2009-01-06 Thread via RT
# New Ticket Created by  Moritz Lenz 
# Please include the string:  [perl #62026]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=62026 >


22:06 <@moritz_> rakudo: class A { has @.a; method b { @.a = <1 2 3> }; };
 A.new.b; say "alive";
22:06 < p6eval> rakudo 35079: OUTPUT«Cannot assign to readonly
variable.␤current instr.: 'die' pc 14950
(src/builtins/control.pir:204)␤»

Rakudo is overly protective here; in methods of the class the assignment
should be allowed.

The same problem exists also for hashes.

I've added tests for that to t/spec/S12-attributes/instance.t.

Cheers,
Moritz


[perl #62028] "say" with no args should be an error

2009-01-06 Thread Dave Whipp
# New Ticket Created by  "Dave Whipp" 
# Please include the string:  [perl #62028]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=62028 >


S16 requires that "say" (and "print") when called with no args should
be a compile-time error. Rakudo accepts it with no error.


[perl #62014] [PATCH] missing "n" in "doesn't" in docs/book/ch03_pir_basics.pod

2009-01-06 Thread Christian Sturm
# New Ticket Created by  "Christian Sturm" 
# Please include the string:  [perl #62014]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=62014 >


There is an missing an in the word doesn't in the Classes and Objects
paragraph of the third chapter in the book. This patch fixes it.

-- 
Christian



fix_doesnt_typo.patch
Description: Binary data


r24789 - docs/Perl6/Spec

2009-01-06 Thread pugs-commits
Author: particle
Date: 2009-01-07 01:53:03 +0100 (Wed, 07 Jan 2009)
New Revision: 24789

Modified:
   docs/Perl6/Spec/S19-commandline.pod
Log:
[S19] rip out option categories and services until they prove useful

Modified: docs/Perl6/Spec/S19-commandline.pod
===
--- docs/Perl6/Spec/S19-commandline.pod 2009-01-06 21:18:51 UTC (rev 24788)
+++ docs/Perl6/Spec/S19-commandline.pod 2009-01-07 00:53:03 UTC (rev 24789)
@@ -209,65 +209,6 @@
 =back
 
 
-=head1 Option Categories
-
-Perl's command line options fall into three categories:
-
-=over 4
-
-=item *
-
-B flags set Perl's operational mode (e.g. I<--doc>, I<-e>).
-Only one mode flag may be specified on the command line.
-
-=item *
-
-B flags may be set on the command line, via the I
-environment variable, or within a file.
-
-[What file?  We need to be Very Careful not to delegate the identity of
-the current language to anything outside of P6.  I would very much hate
-to see anything resembling a .perl6rc file.]
-
-{{ TODO clarify that i mean "source file" here and not an rc-like file }}
-
-=item *
-
-B flags may be set only on the command line, and affect the entire
-run of the program.
-
-[I think this Static/Dynamic distinction is rather meaningless and
-confusing.  Certain commitments will be made by certain phases of
-compilation/linking/running, and every switch is dynamic before the
-commitment, static after.  And Mode flags are just the ones that
-commit so fast they exclude alternatives, seems like...]
-
-{{TODO very well, i'll shift the design to be more dynamic here}}
-
-=back
-
-For more on options and their classifications, see section
-L.
-
-
-=head1 Option Services
-
-Just because Perl 6 gives you a reasonable default command-line parser doesn't
-mean you don't want to extend it, or replace it with something else entirely.
-The command-line processor is organized into a set of services, each of which
-respond to a set of command-line options. These services live in the
-C<{{TODO}}> namespace, and may be overridden by loading a module with the
-C<--option-parser> option (see below).
-
-{{ TODO more details needed }}
-
-[Would like to see a use case for this mechanism.  The whole Services
-concept seems very nebulous, especially when you start giving services
-names like "Awk"..."Autoloop" would be more meaningful.]
-
-{{rename done}}
-
-
 =head1 Option Reference
 
 Perl 6 options, descriptions, and services.
@@ -301,18 +242,12 @@
 
 Turns on autosplit mode.
 
-Service: Autoloop
-
-Notes: Annotates function produced by -n | -p
-
 =item ++ARGSPROC [options, values] ++/ARGSPROC
 
 {{TODO don't like this name, but don't like ++CMD either}}
 
 Add a command-line processor.
 
-Service: Option
-
 Notes: When this option is parsed, it immediately triggers an action that
 could affect the remainder of the parse. Therefore, it's a good idea to put
 this option as early as possible in the argument list.
@@ -324,16 +259,12 @@
 
 Check syntax, then exit.
 
-Service: Runtime
-
 Notes: Desugars to C<++COMPILER -e 'CHECK{ compiles_ok(); exit; }' ++/COMPILER>
 
 =item --doc
 
 perldoc
 
-Service: Doc
-
 Notes: Desugars to
 C<++COMPILER -e 'CHECK{ compiles_ok(); dump_perldoc(); }' ++/COMPILER>
 
@@ -343,8 +274,6 @@
 
 Set debugging flags.
 
-Service: Debugger
-
 Notes: At least it's a start. Need a debugger spec for more.
 
 =item --execute, -e commandline
@@ -356,25 +285,12 @@
 your first -e on the command line should be passed a value of '6', like C<-e6>.
 See L for details.
 
-Service: Runtime
-
-Notes: Returns a function that's executed unless otherwise modified by
-Autoloop service's -p , -n, -a, -F.
-Actually combines all source from all -e parameters, then compiles when
-there are no more -e. Assigns the generated function to MAIN.
-
-[Not really a Mode in the sense you've defined it, but an input
-redirection of a vaguely here-docish flavor.  You could combine it
-with -c or --doc for instance, so not exclusive.]
-
 =item --autoloop-split, -F [string, closure, etc]
 
 Pattern to split on (used with -a). Accepts unicode strings (as long as your
 shell lets you pass them). Allows passing a closure
 (e.g. -F "{use Text::CSV}"). Awk's not better any more :)
 
-Service: Autoloop
-
 Notes: Substitutes a function for the default function which
 is { split ' ' } or whatever.
 
@@ -382,14 +298,10 @@
 
 Print summary of options. Desugars to C<++CMD --print-help --exit ++/CMD>.
 
-Service: Usage
-
 =item --include, -I
 
 Prepend directory to @*INC.
 
-Service: Lib
-
 Notes: this is unspecced elsewhere, so may not survive long.
 
 [at best, @*INC will only be the user's ad hoc libraries.  The API for
@@ -402,23 +314,10 @@
 
 use/no module.
 
-Service: Meta
-
-Notes: Maybe this happens before or affects which services are loaded.
-Or maybe there can be a UNIVERSAL service which knows about other services
-and is built into the interpreter. No looking at disk required?
-
-[I have no idea what you're talkin

r24790 - docs/Perl6/Spec

2009-01-06 Thread pugs-commits
Author: particle
Date: 2009-01-07 01:56:43 +0100 (Wed, 07 Jan 2009)
New Revision: 24790

Modified:
   docs/Perl6/Spec/S19-commandline.pod
Log:
[S19] address concerns about mixing -e and -e6

Modified: docs/Perl6/Spec/S19-commandline.pod
===
--- docs/Perl6/Spec/S19-commandline.pod 2009-01-07 00:53:03 UTC (rev 24789)
+++ docs/Perl6/Spec/S19-commandline.pod 2009-01-07 00:56:43 UTC (rev 24790)
@@ -282,7 +282,7 @@
 each one representing an input line with an implicit newline at the end.
 
 If you wish to run in lax mode, without strictures and warnings enabled,
-your first -e on the command line should be passed a value of '6', like C<-e6>.
+pass a value of '6' to the first -e on the command line, like C<-e6>.
 See L for details.
 
 =item --autoloop-split, -F [string, closure, etc]
@@ -494,9 +494,6 @@
 env var? maybe -E
 
 [could be posed in terms of substituting a different prelude]
-
-mixing -e and -e6 can lead to problems, for example:
-  perl -e "my $x = 1;" -e "print $x" -e6 "if $x"
 }}
 
 =for vim:set expandtab sw=4:



[perl #62030] perl -e does not populate @*ARGS

2009-01-06 Thread mbere...@flashmail.com (via RT)
# New Ticket Created by  mbere...@flashmail.com 
# Please include the string:  [perl #62030]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=62030 >


Up until about mid December 2008, the Rakudo perl6 -e copied
its command line arguments into @*ARGS. Sorry, revision
number unknown. At the end of December, perl6 -e was
ignoring command line arguments. This feature is probably
untested. For example:

perl6 -e 'say @*ARGS' a b c   # should say abc




r24791 - docs/Perl6/Spec

2009-01-06 Thread pugs-commits
Author: lwall
Date: 2009-01-07 02:20:43 +0100 (Wed, 07 Jan 2009)
New Revision: 24791

Modified:
   docs/Perl6/Spec/S11-modules.pod
Log:
[S11] clarify the intent of the -e6 remark not to be special syntax, but
a natural outcome of -e and '6;'


Modified: docs/Perl6/Spec/S11-modules.pod
===
--- docs/Perl6/Spec/S11-modules.pod 2009-01-07 00:56:43 UTC (rev 24790)
+++ docs/Perl6/Spec/S11-modules.pod 2009-01-07 01:20:43 UTC (rev 24791)
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall 
   Date: 27 Oct 2004
-  Last Modified: 26 Feb 2008
+  Last Modified: 06 Jan 2009
   Number: 11
-  Version: 24
+  Version: 25
 
 =head1 Overview
 
@@ -467,7 +467,7 @@
 
 it runs Perl 6 in "lax" mode, without strictures or warnings, since obviously
 a bare literal in a void context I to have produced a warning.
-(Invoking perl with C<-e6> has the same effect.)
+(Invoking perl with C<-e '6;'> has the same effect.)
 
 In the other direction, to inline Perl 5 code inside a Perl 6 program, put
 C at the beginning of a lexical block.  Such blocks can nest 
arbitrarily



Re: returning one or several values from a routine

2009-01-06 Thread Dave Whipp

Daniel Ruoso wrote:


Hmm... I think that takes the discussion to another level, and the
question is:

 "what does a capture returns when coerced to a context it doesn't
provide a value for?"


I'd like to take one step further, and ask what it is that introduced 
capture semantics in the first place. And I suggest that the answer 
should be "the use of a signature"


I'd also suggest that we get rid of the use of backslash as a 
capture-creation operator (the signature of Capture::new can do that) 
and instead re-task it as a "signature" creation operator.


If we do that, then I think we can reduce the discussion of the 
semantics of multi-returns to the semantics of assignments:


If the sub/method defines a return-signature then that is used (with 
standard binding semantics), otherwise the result is semantically a flat 
list.


If the LHS is an assignment is a signature, then the rhs is matched to it:

my  (@a, %b) = 1,2,3, b => 4; ## everything in @a; %b empty
my \(@a, %b) = 1,2,3, b => 4; ## @a = 1,2,3; %b = (b=>4)

If the rhs is the result of a return from a function that has no 
return-signature, then the same semantics would apply


Re: [perl #62024] [TODO]: implement qqx

2009-01-06 Thread Patrick R. Michaud
On Tue, Jan 06, 2009 at 12:11:28PM -0800, Moritz Lenz wrote:
> I know that rakudo doesn't prioritize implementation of the various
> quoting constructs, but there are various things that need testing
> ($*OUT.say, @*ARGS (which seems to be broken atm), command line
> switches, things like RT #61980) that can't be tested without that
> feature, or similar features.
> 
> Any way to execute another command and capture the result without too
> much pain would enable me to write such tests.

Execute another command is easy to handle.  In fact, we already have
C for this.

"Capture the result" is hard.  In fact, it's been a long-requested
feature for Parrot (especially for Parrot testing), but AFAIK
Parrot hasn't provided a way to do this yet.  This might have
changed with the recent I/O changes, though.

I think the related Parrot ticket is RT #46865, which talks about
attempting to capture process output for purposes of testing.

Pm



Re: [perl #62028] "say" with no args should be an error

2009-01-06 Thread Patrick R. Michaud
On Tue, Jan 06, 2009 at 01:50:06PM -0800, Dave Whipp wrote:
> 
> S16 requires that "say" (and "print") when called with no args should
> be a compile-time error. Rakudo accepts it with no error.

Since S16 has been in an incomplete "draft" status for such a long
time, I'd like to get confirmation from p6l about this part of
the spec before committing it to an implementation.

Thanks,

Pm


Re: returning one or several values from a routine

2009-01-06 Thread Jon Lang
Dave Whipp wrote:
> Daniel Ruoso wrote:
>> Hmm... I think that takes the discussion to another level, and the
>> question is:
>>
>>  "what does a capture returns when coerced to a context it doesn't
>> provide a value for?"
>
> I'd like to take one step further, and ask what it is that introduced
> capture semantics in the first place. And I suggest that the answer should
> be "the use of a signature"
>
> I'd also suggest that we get rid of the use of backslash as a
> capture-creation operator (the signature of Capture::new can do that) and
> instead re-task it as a "signature" creation operator.

I believe that we already have a signature creation operator, namely
":( @paramlist )".

Note also that retasking '\' destroys the analogy that currently
exists between perl 6 captures and perl 5 references.

> If we do that, then I think we can reduce the discussion of the semantics of
> multi-returns to the semantics of assignments:
>
> If the sub/method defines a return-signature then that is used (with
> standard binding semantics), otherwise the result is semantically a flat
> list.
>
> If the LHS is an assignment is a signature, then the rhs is matched to it:
>
> my  (@a, %b) = 1,2,3, b => 4; ## everything in @a; %b empty
> my \(@a, %b) = 1,2,3, b => 4; ## @a = 1,2,3; %b = (b=>4)

Change that second line to:

  my :(*...@a, *%b) = 1, 2, 3, b => 4;

@a and %b have to be slurpy so that you don't get a signature
mismatch.  There's also the matter of how a signature with an invocant
would handle the assignment:

  my :($a: *...@b, *%c) = 1, 2, 3, b => 4;

Either $a == 1 and @b == (2, 3) or $a == undef and @b == (1, 2, 3).
Which one is it?  Probably the latter.

Regardless, the magic that makes this work would be the ability to
assign a flat list of values to a signature.  Is this wise?

-- 
Jonathan "Dataweaver" Lang


r24792 - docs/Perl6/Spec

2009-01-06 Thread pugs-commits
Author: masak
Date: 2009-01-07 06:43:05 +0100 (Wed, 07 Jan 2009)
New Revision: 24792

Modified:
   docs/Perl6/Spec/S29-functions.pod
Log:
[S29] put the C function inside a list, for consistency


Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2009-01-07 01:20:43 UTC (rev 24791)
+++ docs/Perl6/Spec/S29-functions.pod   2009-01-07 05:43:05 UTC (rev 24792)
@@ -14,8 +14,8 @@
 Carl Mäsak 
 Moritz Lenz 
  Date:  12 Mar 2005
- Last Modified: 18 Dec 2008
- Version:   33
+ Last Modified: 7 Jan 2009
+ Version:   34
 
 This document attempts to document the list of builtin functions in Perl 6.
 It assumes familiarity with Perl 5 and prior synopses.
@@ -402,11 +402,17 @@
 
 =head2 Complex
 
+=over 4
+
+=item polar
+
 our Seq multi method polar (Complex $nim:) is export
 
 Returns (magnitude, angle) corresponding to the complex number.
 The magnitude is non-negative, and the angle in the range C<-π ..^ π>.
 
+=back
+
 =head2 The :Trig tag
 
 The following are also defined in C but not exported without a C<:Trig>



r24793 - docs/Perl6/Spec

2009-01-06 Thread pugs-commits
Author: masak
Date: 2009-01-07 06:59:42 +0100 (Wed, 07 Jan 2009)
New Revision: 24793

Modified:
   docs/Perl6/Spec/S29-functions.pod
Log:
[S29] added mentions of getc, print, say and printf, with references to S16
for details

Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2009-01-07 05:43:05 UTC (rev 24792)
+++ docs/Perl6/Spec/S29-functions.pod   2009-01-07 05:59:42 UTC (rev 24793)
@@ -15,7 +15,7 @@
 Moritz Lenz 
  Date:  12 Mar 2005
  Last Modified: 7 Jan 2009
- Version:   34
+ Version:   35
 
 This document attempts to document the list of builtin functions in Perl 6.
 It assumes familiarity with Perl 5 and prior synopses.
@@ -1742,6 +1742,41 @@
 
 =back
 
+=head2 IO
+
+=over 4
+
+=item getc
+
+our Bool method getc (IO $self: *...@list)
+
+See C for details.
+
+=item print
+
+our Bool method print (IO $self: *...@list)
+our Bool multi print (*...@list)
+our Bool method print (Str $self: IO $io)
+
+See C for details.
+
+=item say
+
+our Bool method say (IO $self: *...@list)
+our Bool multi say (*...@list)
+our Bool method say (Str $self: IO $io)
+
+See C for details.
+
+=item printf
+
+our Bool method printf (IO $self: Str $fmt, *...@list)
+our Bool multi printf (Str $fmt, *...@list)
+
+See C for details.
+
+=back
+
 =head2 OS
 
 =over



r24794 - docs/Perl6/Spec

2009-01-06 Thread pugs-commits
Author: masak
Date: 2009-01-07 07:00:46 +0100 (Wed, 07 Jan 2009)
New Revision: 24794

Modified:
   docs/Perl6/Spec/S16-io.pod
Log:
[S16] slight disambiguation

Modified: docs/Perl6/Spec/S16-io.pod
===
--- docs/Perl6/Spec/S16-io.pod  2009-01-07 05:59:42 UTC (rev 24793)
+++ docs/Perl6/Spec/S16-io.pod  2009-01-07 06:00:46 UTC (rev 24794)
@@ -12,7 +12,7 @@
  Contributions: Mark Stosberg 
  Date:  12 Sep 2006
  Last Modified: 1 May 2007
- Version:   17
+ Version:   18
 
 This is a draft document. Many of these functions will work as in Perl
 5, except we're trying to rationalize everything into packages.  For
@@ -366,7 +366,7 @@
 our Bool multi printf (Str $fmt, *...@list)
 
 The function form works as in Perl 5 and always prints to $*DEFOUT.
-The method form uses IO handles as objects, not formats.
+The method form uses IO handles, not formats, as objects.
 
 =back
 



r24795 - docs/Perl6/Spec

2009-01-06 Thread pugs-commits
Author: masak
Date: 2009-01-07 07:25:35 +0100 (Wed, 07 Jan 2009)
New Revision: 24795

Modified:
   docs/Perl6/Spec/S29-functions.pod
Log:
[S29] added .succ/.pred for Num, Int and Bool

Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2009-01-07 06:00:46 UTC (rev 24794)
+++ docs/Perl6/Spec/S29-functions.pod   2009-01-07 06:25:35 UTC (rev 24795)
@@ -15,7 +15,7 @@
 Moritz Lenz 
  Date:  12 Mar 2005
  Last Modified: 7 Jan 2009
- Version:   35
+ Version:   36
 
 This document attempts to document the list of builtin functions in Perl 6.
 It assumes familiarity with Perl 5 and prior synopses.
@@ -287,6 +287,22 @@
 
 =over
 
+=item succ
+
+ our Num multi method succ ( Num $x: ) is export
+ out Int multi method succ ( Int $x: ) is export
+
+Returns the successor of C<$x>. This method is used by C<< prefix:<++> >> and
+C<< postfix:<++> >> to increment the value in a container.
+
+=item pred
+
+ our Num multi method pred ( Num $x: ) is export
+ our Int multi method pred ( Int $x: ) is export
+
+Returns the predeccessor of C<$x>. This method is used by C<< prefix:<--> >>
+and C<< postfix:<--> >> to decrement the value in a container.
+
 =item abs
 
  our Num multi method abs ( Num $x: ) is export
@@ -458,6 +474,22 @@
 
 =back
 
+=head2 Bool
+
+=over 4
+
+=item succ
+
+ our Bool multi method succ ( Bool $b: ) is export
+
+Returns C.
+
+=item pred
+
+ our Bool multi method pred ( Bool $b: ) is export
+
+Returns C.
+
 =head2 Scalar
 
 B: L