S26 Draft

2005-04-10 Thread Brian Ingerson
Per autrijus request, I have written a preliminary Synopsis 26 -- Perl
Documentation. For your ripping apart pleasures:

http://svn.openfoundry.org/pugs/docs/S26draft.pod

Cheers, Brian


[S29] update (was: Re: Question about $pair.kv)

2005-04-10 Thread Ingo Blechschmidt
Hi, 
 
Luke Palmer luke at luqui.org writes: 
 Stevan Little writes: 
  One tests shows $pair.kv returning an array with two elements (the key  
  and value of the pair). (This is also how Pugs currently implements  
  this.) 
  
 The former is certainly correct.  When all else fails, consider a pair 
 to be a one-element hash. 
 
then the S29 draft (http://www.rodadams.net/Perl/S29.html) needs 
updating, as currently it states: 
 What is returned at each element of the iteration varies 
 with function. values returns the value of the associated 
 element; **kv returns a 2 element list in (index, value) 
 order**, pairs a Pair(index, value). 
 
Unless, of course, I misunderstand any(S29, Luke) :) -- 
Is the following correct? 
  my @array = a b c; 
  my @kv= @array.kv; 
  say [EMAIL PROTECTED];  # 6 
  say [EMAIL PROTECTED];  # 0 a 1 b 2 c 
 
FYI, before your post, my assumption was: 
  my @array = a b c; 
  my @kv= @array.kv; 
  say [EMAIL PROTECTED];  # 3 
  say [EMAIL PROTECTED];   # 0 a 
  say [EMAIL PROTECTED];   # 1 b 
  say [EMAIL PROTECTED];   # 2 c 
  # That means, @kv = ([0, a], [1, b], [2, c]) 
 
 
--Ingo 
 
--  
Linux, the choice of a GNU | Life would be so much easier if we could 
generation on a dual AMD   | just look at the source code. 
Athlon!| -- Dave Olson   



Re: S26 Draft

2005-04-10 Thread Yuval Kogman
Please don't be lazy, everyone, and look at this:

http://svn.openfoundry.org/pugs/docs/

There are some more drafts that should be reviewed, and more will
probably follow.

-- 
 ()  Yuval Kogman [EMAIL PROTECTED] 0xEBD27418  perl hacker 
 /\  kung foo master: uhm, no, I think I'll sit this one out..: neeyah!



pgpUgS9HFH7bz.pgp
Description: PGP signature


Re: S26 Draft

2005-04-10 Thread Aaron Sherman
On Sun, 2005-04-10 at 14:02 +0300, Yuval Kogman wrote:
 Please don't be lazy, everyone, and look at this:
 
 http://svn.openfoundry.org/pugs/docs/
 
 There are some more drafts that should be reviewed, and more will
 probably follow.

Can we please be rid of:

http://svn.openfoundry.org/pugs/docs/advocacy/phd.png

It's just rude, and Perl's public face should never be one of rudeness.




[S06] Types of subroutines/blocks/etc.

2005-04-10 Thread Ingo Blechschmidt
Hi,

A06 states:
   Code
|
   | |
RoutineBlock
   |_____|___
  | |   |   || |  |  |
 Sub Method Submethod Multi Rule Macro  Bare Parametric
[...]
 (It's not yet clear whether the CBare vs CParametric
 distinction is useful.  Some apparently CBare blocks are
 actually CParametric if they refer to C$_ internally, even
 implicitly.  And a CBare block is just a CParametric block
 with a signature of C(). More later.)

S06 mentions Bare and Parametric only in the table of standard type
names (with a at least this week on top of it).

So, what are the types of the following Code references?
  my $foo = sub ($x) { $x }; # isa Code, Routine, Sub?
  my $foo = sub ()   { 42 }; # isa Code, Routine, Sub?

  my $foo = - $x { 42 };# isa Code, Block, Parametric?
  my $foo = { $^x }; # isa Code, Block, Parametric?
  my $foo = { say }; # (uses $_) # isa Code, Block, Parametric?

  my $foo = { 42 };  # isa Code, Block, Bare?
  my $foo = - { 42 };   # isa Code, Block, Bare?

FWIW, I don't think the distinction Bare-Parametric is really useful.
And as there's no distinction between Csub () {...} and Csub (...)
{...} either, I'd vote for dropping the Bare-Parametric distinction
and updating S06 accordingly.


--Ingo

-- 
Linux, the choice of a GNU | Wissen ist Wissen, wo man es findet.  
generation on a dual AMD   | 
Athlon!| 



Aliasing swapped values

2005-04-10 Thread Ovid
Hi all,

Apologies if this has been covered.  What should this do?

  ($x,$y) := ($y,$x);

In Perl5:

  $x=2; $y=3;
  print x: $x y: $y\n;
  (*::x, *::y) = (*::y, *::x);
  $y=4;
  print x: $x y: $y\n;
  $x=5;
  print x: $x y: $y\n;

This program shows typeglob aliasing.  If we try to alias swapped
value, we merely swap what they are pointing at and we haven't aliased
anything.  I am not sure this should be appropriate behavior for Perl6.
 Aliasing will be much more common in Perl6 so this will be a trap for
many.  In fact, consider this:

  ($c, $d) := ($y, $x);
  # later
  ($x,$y) := ($c, $d); # whoops!

That's going to confuse the heck out of people.  If we do as Perl5
does, we'll merely be swapping values since aliasing really doesn't
make much sense here, but that means for this case, := == =.

Cheers,
Ovid

-- 
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/


Re: [S29] update

2005-04-10 Thread Rod Adams
Ingo Blechschmidt wrote:
then the S29 draft (http://www.rodadams.net/Perl/S29.html) needs 
updating, as currently it states: 
 

What is returned at each element of the iteration varies 
with function. values returns the value of the associated 
element; **kv returns a 2 element list in (index, value) 
order**, pairs a Pair(index, value). 
   

Unless, of course, I misunderstand any(S29, Luke) :) -- 
Is the following correct? 
 my @array = a b c; 
 my @kv= @array.kv; 
 say [EMAIL PROTECTED];  # 6 
 say [EMAIL PROTECTED];  # 0 a 1 b 2 c 

Yes.
As for S29, in my head, a list of lists is still just a list. An array 
of arrays is a different story.

So this behavior is what I meant to say in S29. If it's unclear, I'm 
open to suggestions.

-- Rod Adams
(who still needs more time to work on S29. Looks like I'll have some in 
a few weeks. In the meantime, if there's someone else out there itching 
to work on it, let me know.)


Re: S26 Draft

2005-04-10 Thread Brian Ingerson
On 10/04/05 09:58 -0400, Aaron Sherman wrote:
 On Sun, 2005-04-10 at 14:02 +0300, Yuval Kogman wrote:
  Please don't be lazy, everyone, and look at this:
  
  http://svn.openfoundry.org/pugs/docs/
  
  There are some more drafts that should be reviewed, and more will
  probably follow.
 
 Can we please be rid of:
 
 http://svn.openfoundry.org/pugs/docs/advocacy/phd.png
 
 It's just rude, and Perl's public face should never be one of rudeness.

Applied, thanks.


Re: Aliasing swapped values

2005-04-10 Thread Juerd
Ovid skribis 2005-04-10 10:47 (-0700):
 Apologies if this has been covered.  What should this do?
   ($x,$y) := ($y,$x);

It would let $x be a second name for the variable that is also called
$y, and $y for $x. The old names $x and $y are overwritten, so
essentially the names for the two variables swapped without copying or
moving values around.

This is assuming that bound variables are visible only after the entire
bind expression is handled. Which would have to mean that the
expressions for default values are special.

   ($c, $d) := ($y, $x);
   # later
   ($x,$y) := ($c, $d); # whoops!

I imagine that that has the same effect as

($x, $y) := ($y, $x);
($c, $d) := ($x, $y);

Of which I wonder if it can be written as

($c, $d) := ($x, $y) := ($y, $x);


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html