take()'s return value

2007-01-29 Thread gabriele renzi

Hi everyone,

I wonder: why does take inside a gather structure returns undef?
I think it would be nicer if it could return the taken value, so that, 
for example one can write something like:


 say take 2

or like:

 while cond($n) {
  my $res = compute($n)
  $n /= take($res)
 }

there is a reason why this is a completely stupid idea?


Re: take()'s return value

2007-01-29 Thread Carl Mäsak

gabriele (>):

I wonder: why does take inside a gather structure returns undef?
I think it would be nicer if it could return the taken value, so that,
for example one can write something like:

  say take 2

or like:

  while cond($n) {
   my $res = compute($n)
   $n /= take($res)
  }

there is a reason why this is a completely stupid idea?


I was thinking the same thing the other day. Maybe this is a good one
to post to p6l, actually. Unless someone already knows the answer or
can find it in the synopses.

// Carl


Parrot Bug Summary

2007-01-29 Thread Parrot Bug Summary
Parrot Bug Summary

http://rt.perl.org/rt3/NoAuth/parrot/Overview.html
Generated at Mon Jan 29 14:00:09 2007 GMT
---

  * Numbers
  * New Issues
  * Overview of Open Issues
  * Ticket Status By Version
  * Requestors with most open tickets

---

Numbers

Ticket Counts: 75 new + 378 open = 453
Created this week: 14
Closed this week: 11

---

New Issues

New issues that have not been responded to yet

1 - 2 weeks old
41310 [CAGE] autogenerated PMC stubs kill compile
41293 [BUG]: t/compilers/tge/basic.t: Failed during 'make test' but passed with
  'prove'
41286 [PDD] revisit properties
41280 [PDD] adding methods to subs as objects
2 - 3 weeks old
41265 [TODO] PGE: refactor pod_comment rule into PGE/Util.pbc
41264 [PDD] should properties get serialized?
41263 [PDD] should/can high-level classes be constructed at compile-time?
41257 [tru64] core dump in t/pmc/io_1.pir
41256 [tru64] NaNQ failures in t/pmc/complex
41255 [tru64] core dump from t/pmc/pmc_5.pasm
41254 [tru64] core dump from library/pg
41253 [tru64] core dump from t/dynoplibs/myops_3.pir
41251 [tru64] core dump from t/pmc/resizablebooleanarray_20.pasm
41249 [tru64] core dump in t/pmc/interp_3.pir
41242 Compile on Linux with Intel C++ and Sun Studio for Linux
41231 [TODO] exempt languages/ files from perlcritic testing
41226 [TODO] hunt through DEPRECATED.pod and find things to deprecate
41218 [BUG] warnings in imcc lexer code
3 - 4 weeks old
41201 [TODO] Remove temporary conf hack in Configure.pl
41168 graceful "no compiler" error message?
4 - 5 weeks old
5 - 6 weeks old
6 - 7 weeks old
41097 Segfault in malformed get_results
7 - 8 weeks old
8 - 9 weeks old
41035 [BUG] Parrot segfaults in perl6 08-regex.t (GC/pointer bug?)
41031 bad links in docs/ROADMAP.pod
9 - 10 weeks old
40990 [BUG] Parrot segfaults in perl6 08-regex.t (GC/pointer bug?)
40972 Iterator over Env under Win32
10 - 11 weeks old
40923 test errors
11 - 12 weeks old
40830 [PATCH] Man-Chicken's awesome hackathon throw-away patches...
40826 Mac OS X and Dylib Funcs
40822 Pg NCI Test Makes Unportable Connection
40804 -j fails: Stack alignment of x86 JIT on Mac
12 - 13 weeks old
13 - 14 weeks old
40599 [NEW] Coding standards test of return statements
14 - 15 weeks old
15 - 16 weeks old
40490 Flat/Slurpy Named Parameter Passing Errors
16 - 17 weeks old
17 - 18 weeks old
18 - 19 weeks old
19 - 20 weeks old
20 - 21 weeks old
---

Overview of Open Issues

Platform   Severity   Tag  Lang
aix   0abandoned 05005threads   0  Amber0
All   2fatal 3bounce0  BASIC0
bsdos 0High  1Bug  42  bc   0
cygwin6low   1compiler  0  befunge  0
cygwin_nt 0medium1configure 0  bf   0
darwin0none  0core  0  cola 0
dec_osf   0Normal1dailybuild0  forth0
dgux  0unknown   0docs  0  jako 0
dos   0Wishlist  3duplicate 0  Lisp 0
dynixptx  0  install   1  m4   0
freebsd   1   library   0  ook  0
generic   0   notabug   0  perl60
gnu   0   notok 0  plot 0
HPUX  0   ok0  punie0
irix  0   Patch21  python   0
irix640   regex 0  ruby 0
Linux 0   sendToCPAN0  scheme   0
lynxos0   Todo262  tcl 89
mac   0   unknown   0  urm  0
machten   0   utilities 0  Zcode0
macos 0   wontfix   0
MacOS X   0
mswin32   0
netbsd1
next  0
openbsd   1
os2   0
os390 0
other 0
powerux   0
qnx   0
riscos0
sco   0
Solaris   1
sunos 0
svr4  0
svr5  0
sysv  0
unicos0
unicosmk  0
unix  0
unknown   0
uts   0
vms   0
VOS   0
Win32 3
---

Ticket Status By Version

New or OpenResolved

---

Requestors with most open tickets

Paul Cochrane   70
Will Coleda 57
[EMAIL PROTECTED]  

[PATCH] PDD22 spec notes and ParrotIO tests

2007-01-29 Thread jerry gay

i spent some time with PDD22 this week. i've started writing tests for
the ParrotIO object, which you'll find in the attached patch. you'll
also find some notes i've made both in the test file, and in the spec.

i find writing spec-based tests to be extremely enlightening. the act
of writing code (tests) based on the spec helps solidify the use
cases, since they make themselves clear as you're coding. also, using
a testing mentality, which promotes thoughts about failure modes and
edge cases, helps find places where the spec may be unclear or missing
information. lastly, having a rather complete set of tests for a
specification will make it's implementation worlds easier and faster.

i'd like to encourage this style among interested parroters. other
specs (namespaces, for one--but really any PDD, approved or draft)
could use this treatment as well. i plan to continue to develop tests
this way, and i hope some of you will join me. as always, comments and
questions are welcome and appreciated.

~jerry

i'll apply this patch in two days if nobody objects. in the meantime,
i'll be working on tests for the remainder of the spec (eg. status
object pmc api, and i/o stream, filesystem, and network opcodes.)
Index: docs/pdds/pdd22_io.pod
===
--- docs/pdds/pdd22_io.pod	(revision 16821)
+++ docs/pdds/pdd22_io.pod	(working copy)
@@ -104,6 +104,13 @@
 
 =over 4
 
+{{ the io object should be given an official name and namespace, eg. ParrotIO
+   or [ 'ParrotIO' ], and references throughout the doc should consistently
+   use this name, instead of generic terms like 'an I/O stream object'.
+   I used ParrotIO cause that's what it's currently called, but Stream might
+   be a more appropriate name.
+}}
+
 =item new
 
   $P0 = new ParrotIO
@@ -111,6 +118,8 @@
 Creates a new I/O stream object. [Note that this is usually performed
 via the C opcode.]
 
+{{ how does .open usually perform .new? .open requires a ParrotIO object }}
+
 =item open
 
   $P0.open()
@@ -123,6 +132,8 @@
 etc), using the same format as the C opcode: 'r' for read, 'w' for
 write, 'a' for append, and 'p' for pipe.
 
+{{ no async form for .open? will it create a file if none exists? }}
+
 =item close
 
   $P0.close()
@@ -136,6 +147,8 @@
 over just leaving the object for the GC to clean-up, but it does give
 you the option of executing an action when the stream has been closed.]
 
+{{ no async for .close? }}
+
 =item print
 
   $P0.print($I1)
@@ -153,6 +166,8 @@
 argument $P2. When the print operation is complete, it invokes the callback,
 passing it a status object.
 
+{{ how about a .say method that appends a record separator automatically? }}
+
 =item read
 
   $S0 = $P1.read($I2)
@@ -173,6 +188,9 @@
 as the information about the character encoding of the return value is
 contained in the string.]
 
+{{ if you specify more bytes than are available, does it let you know? }}
+{{ how about a .chomp method? }}
+
 =item readline
 
   $S0 = $P1.readline()
@@ -188,6 +206,8 @@
 is complete, it invokes the callback, passing it a status object and a
 string of bytes.
 
+{{ does this autochomp? }}
+
 =item record_separator
 
   $S0 = $P1.record_separator()
@@ -195,6 +215,8 @@
 
 Accessor (get and set) for the I/O stream's record separator attribute.
 
+{{ what's the default? --perhaps dependent upon stream type? }}
+
 =item buffer_type
 
   $I0 = $P1.buffer_type()
@@ -230,6 +252,12 @@
 provide the logic that marks the buffer as "full" when it can't hold the
 next codepoint even if there are empty bytes in the buffer.
 
+{{
+   are only 'postive integer values' allowed?
+   what happens when changing size on a buffer with existing data?
+   does this only work with PIO_FULLBUF mode?
+}}
+
 =item get_fd
 
   $I0 = $P1.get_fd()
@@ -242,6 +270,8 @@
 
 No asynchronous version.
 
+{{ NOTE: use a config probe (behind does or can) to determine support }}
+
 =back
 
 =head2 Status Object PMC API
Index: t/pmc/parrotio.t
===
--- t/pmc/parrotio.t	(revision 16821)
+++ t/pmc/parrotio.t	(working copy)
@@ -6,7 +6,7 @@
 use warnings;
 use lib qw( . lib ../lib ../../lib );
 use Test::More;
-use Parrot::Test tests => 1;
+use Parrot::Test tests => 6;
 
 =head1 NAME
 
@@ -22,15 +22,270 @@
 
 =cut
 
+# L
 pir_output_is( <<'CODE', <<'OUT', 'new' );
 .sub 'test' :main
 new P0, .ParrotIO
-print "ok 1\n"
+say "ok 1 - $P0 = new .ParrotIO"
 .end
 CODE
-ok 1
+ok 1 - $P0 = new .ParrotIO
 OUT
 
+
+# L
+pir_output_is( <<'CODE', <<'OUT', 'open and close - synchronous', todo => 'not yet implemented' );
+.sub 'test' :main
+$P0 = new .ParrotIO
+$P0.open('README')
+say "ok 1 - $P0.open($S1)"
+
+$P0.close()
+say "ok 2 - $P0.close()"
+
+$P0.open('README', 'rw')
+say "ok 3 - $P0.open($S1, $S2)"
+
+$P0.close()
+$P0.open()
+say "ok 4 - $P0.open()"
+
+push_eh eh_bad_file_1
+$P0.open('bad_file')
+clear_eh
+
+  test_5:

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

2007-01-29 Thread larry
Author: larry
Date: Mon Jan 29 10:39:25 2007
New Revision: 13543

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

Log:
Note that take is intended to work en passant as suggested by gabriele renzi++
Also clarified that gather provides a void context to its victim.


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podMon Jan 29 10:39:25 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 19 Aug 2004
-  Last Modified: 25 Jan 2007
+  Last Modified: 29 Jan 2007
   Number: 4
-  Version: 48
+  Version: 49
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -435,13 +435,33 @@
 explicit because it's not out front where it can be seen.  You can, of
 course, use a placeholder parameter if you also use C.)
 
+=head2 The gather statement
+
 A variant of C is C.  Like C, it is followed by a
-statement or block, and executes it once.  Unlike C, its return
-value is specified by calling the C function one or more times
-within the dynamic scope of the gather.  The returned values are in
-the form of a lazy multislice, with each dimension corresponding to
-one C slice.  (A multislice is flattened in most list contexts.).
-A C is not considered a loop.
+statement or block, and executes it once.  Unlike C, it evaluates the
+statement or block in void context; its return
+value is instead specified by calling the C function one or more times
+within the dynamic scope of the gather.  The returned values are in the
+form of a lazy multislice, with each slice corresponding to one
+C capture.  (A multislice is lazily flattened in normal list context,
+but you may "unflatten" it again with a @@() contextualizer.)
+
+Because C evaluates its block or statement in void context,
+this typically causes the C statement to be evaluated in void
+context.  However, a C statement that is not in void context
+gathers its arguments I and also returns them unchanged.
+This makes it easy to keep track of what you last "took":
+
+my @uniq = gather for @list {
+state $previous = take $_;
+next if $_ === $previous;
+$previous = take $_;
+}
+
+A C is not considered a loop, but it is easy to combine with a loop
+as in the example above.
+
+=head2 Other C-like forms
 
 Other similar C-only forms may also take bare statements,
 including C, C, C, and C.  These constructs


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

2007-01-29 Thread larry
Author: larry
Date: Mon Jan 29 10:45:26 2007
New Revision: 13544

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

Log:
Minor cleanups


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podMon Jan 29 10:45:26 2007
@@ -441,14 +441,14 @@
 statement or block, and executes it once.  Unlike C, it evaluates the
 statement or block in void context; its return
 value is instead specified by calling the C function one or more times
-within the dynamic scope of the gather.  The returned values are in the
+within the dynamic scope of the C.  The returned values are in the
 form of a lazy multislice, with each slice corresponding to one
 C capture.  (A multislice is lazily flattened in normal list context,
-but you may "unflatten" it again with a @@() contextualizer.)
+but you may "unflatten" it again with a C<@@()> contextualizer.)
 
 Because C evaluates its block or statement in void context,
-this typically causes the C statement to be evaluated in void
-context.  However, a C statement that is not in void context
+this typically causes the C function to be evaluated in void
+context.  However, a C function that is not in void context
 gathers its arguments I and also returns them unchanged.
 This makes it easy to keep track of what you last "took":
 


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

2007-01-29 Thread Gaal Yahas
On Mon, Jan 29, 2007 at 10:39:27AM -0800, [EMAIL PROTECTED] wrote:
> +Because C evaluates its block or statement in void context,
> +this typically causes the C statement to be evaluated in void
> +context.  However, a C statement that is not in void context
> +gathers its arguments I and also returns them unchanged.
> +This makes it easy to keep track of what you last "took":
> +
> +my @uniq = gather for @list {
> +state $previous = take $_;
> +next if $_ === $previous;
> +$previous = take $_;
> +}

What does it mean for take to be evaluated in void context?

What are the gathered values here?

   take 1, 2;  # easy. flattened 1 and then 2, right?
   @x = take 1, 2; # same thing?
   $x = take 1, 2; # same thing? [1, 2]?

-- 
Gaal Yahas <[EMAIL PROTECTED]>
http://gaal.livejournal.com/


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

2007-01-29 Thread Gaal Yahas
On Mon, Jan 29, 2007 at 10:01:08PM +0200, Gaal Yahas wrote:
> > +Because C evaluates its block or statement in void context,
> > +this typically causes the C statement to be evaluated in void
> > +context.  However, a C statement that is not in void context
> > +gathers its arguments I and also returns them unchanged.
> > +This makes it easy to keep track of what you last "took":
> > +
> > +my @uniq = gather for @list {
> > +state $previous = take $_;
> > +next if $_ === $previous;
> > +$previous = take $_;
> > +}
> 
> What does it mean for take to be evaluated in void context?
> 
> What are the gathered values here?
> 
>take 1, 2;  # easy. flattened 1 and then 2, right?
>@x = take 1, 2; # same thing?
>$x = take 1, 2; # same thing? [1, 2]?

In fact, $x = take 5;# if this were Perl 5, I might expect
 # either 1 or [1] here!

-- 
Gaal Yahas <[EMAIL PROTECTED]>
http://gaal.livejournal.com/


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

2007-01-29 Thread Gaal Yahas
On Mon, Jan 29, 2007 at 10:08:34PM +0200, Gaal Yahas wrote:
> On Mon, Jan 29, 2007 at 10:01:08PM +0200, Gaal Yahas wrote:
> > > +Because C evaluates its block or statement in void context,
> > > +this typically causes the C statement to be evaluated in void
> > > +context.  However, a C statement that is not in void context
> > > +gathers its arguments I and also returns them unchanged.
> > > +This makes it easy to keep track of what you last "took":
> > > +
> > > +my @uniq = gather for @list {
> > > +state $previous = take $_;
> > > +next if $_ === $previous;
> > > +$previous = take $_;
> > > +}
> > 
> > What does it mean for take to be evaluated in void context?
> > 
> > What are the gathered values here?
> > 
> >take 1, 2;  # easy. flattened 1 and then 2, right?
> >@x = take 1, 2; # same thing?
> >$x = take 1, 2; # same thing? [1, 2]?
> 
> In fact, $x = take 5;# if this were Perl 5, I might expect
>  # either 1 or [1] here!

Ugh, sorry, I meant either 1 or [5].

-- 
Gaal Yahas <[EMAIL PROTECTED]>
http://gaal.livejournal.com/


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

2007-01-29 Thread larry
Author: larry
Date: Mon Jan 29 14:06:49 2007
New Revision: 13545

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

Log:
Clarifications requested by gaal++.


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podMon Jan 29 14:06:49 2007
@@ -438,12 +438,19 @@
 =head2 The gather statement
 
 A variant of C is C.  Like C, it is followed by a
-statement or block, and executes it once.  Unlike C, it evaluates the
-statement or block in void context; its return
-value is instead specified by calling the C function one or more times
-within the dynamic scope of the C.  The returned values are in the
-form of a lazy multislice, with each slice corresponding to one
-C capture.  (A multislice is lazily flattened in normal list context,
+statement or block, and executes it once.  Unlike C, it evaluates
+the statement or block in void context; its return value is instead
+specified by calling the C list prefix operator one or more times
+within the dynamic scope of the C.  The C function's
+signature is like that of C; it merely captures the C
+of its argments without imposing any additional constraints (in the
+absense of context propagation by the optimizer).  The value returned
+by the C to its own context is that same C object (which
+is ignored when the C is in void context).  Regardless of the
+C's context, the C object is also added to the list of
+values being gathered, which is returned by the C in the form
+of a lazy multislice, with each slice corresponding to one C
+capture.  (A multislice is lazily flattened in normal list context,
 but you may "unflatten" it again with a C<@@()> contextualizer.)
 
 Because C evaluates its block or statement in void context,
@@ -458,8 +465,34 @@
 $previous = take $_;
 }
 
+The C function essentially has two contexts simultaneously, the
+context in which the gather is operating, and the context in which the
+C is operating.  These need not be identical contexts, since they
+may bind or coerce the resulting captures differently:
+
+my @y;
+@x = gather for 1..2 {  # @() context for list of captures
+my $x = take $_, $_ * 10;   # $() context for individual capture
+push @y, $x;
+}
+# @x returns 1,10,2,20
+# @y returns [1,10],[2,20]
+
+Likewise, we can just remember the gather's result by binding and
+later coerce it:
+
+$c := gather for 1..2 {
+take $_, $_ * 10;
+}
+# @$c returns 1,10,2,20
+# @@$c returns [1,10],[2,20]
+# $$c returns [[1,10],[2,20]]
+
+Note that the C itself is in void context in this example because
+the C loop is in void context.
+
 A C is not considered a loop, but it is easy to combine with a loop
-as in the example above.
+statement as in the examples above.
 
 =head2 Other C-like forms
 


Re: take()'s return value

2007-01-29 Thread Larry Wall
On Mon, Jan 29, 2007 at 01:22:49PM +0100, Carl Mäsak wrote:
: gabriele (>):
: >I wonder: why does take inside a gather structure returns undef?
: >I think it would be nicer if it could return the taken value, so that,
: >for example one can write something like:
: >
: >  say take 2
: >
: >or like:
: >
: >  while cond($n) {
: >   my $res = compute($n)
: >   $n /= take($res)
: >  }
: >
: >there is a reason why this is a completely stupid idea?
: 
: I was thinking the same thing the other day. Maybe this is a good one
: to post to p6l, actually. Unless someone already knows the answer or
: can find it in the synopses.

Hmm, it's been discussed, but for some reason didn't make it into the spec.
I've now fixed that in S04.  Thanks for the reminder!

Larry


Porting parrot on PDA

2007-01-29 Thread Aldo Calpini

hello people!

I'm really interested in porting parrot to PDA (well, PocketPC at least).

some days ago I stumbled upon CeGCC (a cross compiler for PocketPC), 
which is basically a windows port of gcc (both cygwin and mingw32 
flavours) that produces ARM executable code.


I started playing with it, trying to use it to build parrot; with just a 
few hours hacking, I managed to build a miniparrot.exe that actually 
runs (sort of) on PocketPC.



I understand that what I've done is just a drop in the ocean, and that a 
real porting would require tons and tons of work more, but at least this 
first effort looks promising :-)


now I will try to report briefly what I've done so far. I obviously 
started with "perl Configure.pl --ask", from a Cygwin bash shell. 
mainly, I told Configure to use "arm-wince-pe-gcc" instead of just "gcc" 
as the compiler, linker etc. and I disabled completely jit, threads and 
all the frills.


of course, all the tests which relies on a test executable failed; they 
did compile indeed, but the executable couldn't be run on the desktop 
PC. that's the biggest problem, I suppose :-)


so, I had to manually adjust lots of #define in config.h, has_headers.h, 
and later some minor fixes to feature.h, io.h and thread.h.


I had problems with compiling src/stm/backend.c, turned out that the 
parameters to PARROT_ATOMIC_PTR_GET in atomic.h were reversed (this may 
be a bug not related to building with cegcc, I don't know); and 
ATOMIC_SET isn't defined, so I provided an optimistic (!):


#define ATOMIC_SET(a,b) (a).val = b;

I had to adjust also src/platform.c (the bits that come from 
config/gen/platform/generic/exec.c) because cegcc doesn't provide fork, 
execlp and waitpid. I used vfork, execvp and wait instead (I know, the 
last one isn't equivalent at all -- a problem for later!).


at this point, miniparrot.exe was built. the process can't go much 
further because, obviously, that miniparrot doesn't execute on the 
desktop PC.


anyway, I tried copying the executable on the device, and it does run! 
here's a transcript from my PocketConsole session:


\CF Card\dada> miniparrot -h
Couldn't create message pipe
\CF Card\dada>

something apparently didn't work with regard to thread handling. but it 
shouldn't be that hard to fix.


the biggest problem, as mentioned, is that the build process needs 
fundamentally to execute stuff (built for the device, that is). this 
would require some serious hacking. IIRC, there are command line tools 
to copy and even execute files directly on the device. this would make 
possible to grab somehow the output and keep the build system happy.


I will try, if I can, to search for a viable solution in the next days. 
if there's anybody else interested who wants to join the effort, let me 
know :-)


cheers,
Aldo



Re: [PATCH] PIR language using PGE (2)

2007-01-29 Thread jerry gay

On 1/26/07, Klaas-Jan Stol <[EMAIL PROTECTED]> wrote:

attached is a patch including the PIR language using PGE.

My earlier patch was not (yet) delivered, so I'm sending the zip'ed
version, which is much smaller.


great! this has been applied (with changes to make it cross-platform
friendly) as r16831.
patches are most certainly welcome.

~jerry


[perl #41371] [TODO] review parrot roles & responsibilies doc before next release

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


committed as docs/roles_responsibilities.pod in r16834, project team
members should review this doc for correctness and completeness before
0.4.9 is released. don't forget to update the stability classification
once complete.
~jerry


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

2007-01-29 Thread Gaal Yahas
On Mon, Jan 29, 2007 at 02:06:51PM -0800, [EMAIL PROTECTED] wrote:
> +The C function essentially has two contexts simultaneously, the
> +context in which the gather is operating, and the context in which the
> +C is operating.  These need not be identical contexts, since they
> +may bind or coerce the resulting captures differently:
> +
> +my @y;
> +@x = gather for 1..2 {  # @() context for list of captures
> +my $x = take $_, $_ * 10;   # $() context for individual capture
> +push @y, $x;
> +}
> +# @x returns 1,10,2,20
> +# @y returns [1,10],[2,20]

XXX = gather {
YYY
take f();
ZZZ
}

sub f () {
return want.Scalar ?? 42 !! 54;
}

Which of XXX, YYY, and ZZZ influence whether the taken value is 42 or
54? Please confirm there's *no way* that &f is entered twice here :-)

(If I'm following correctly, then take's args are basically evaluated
in list context. If YYY is something like "$scalar = " that list gets
Captured, but there's still a list there.)

-- 
Gaal Yahas <[EMAIL PROTECTED]>
http://gaal.livejournal.com/


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

2007-01-29 Thread larry
Author: larry
Date: Mon Jan 29 16:05:40 2007
New Revision: 13546

Modified:
   doc/trunk/design/syn/S04.pod
   doc/trunk/design/syn/S06.pod

Log:
More infonuggets for gaal++.


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podMon Jan 29 16:05:40 2007
@@ -14,7 +14,7 @@
   Date: 19 Aug 2004
   Last Modified: 29 Jan 2007
   Number: 4
-  Version: 49
+  Version: 50
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -494,6 +494,14 @@
 A C is not considered a loop, but it is easy to combine with a loop
 statement as in the examples above.
 
+If any function called as part of a C list asks what its context
+is, it will be told it was called in list context regardless of the
+eventual binding of the returned C.  If that is not the
+desired behavior you must coerce the call to an appropriate context.
+In any event, such a function is called only once at the time the
+C object is generated, not when it is bound (which could
+happen more than once).
+
 =head2 Other C-like forms
 
 Other similar C-only forms may also take bare statements,

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podMon Jan 29 16:05:40 2007
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 28 Jan 2007
+  Last Modified: 29 Jan 2007
   Number: 6
-  Version: 67
+  Version: 68
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -1621,6 +1621,15 @@
 caller may use C<< prefix:<|> >> to inline the returned values as part of the
 new argument list.  The caller may also bind the returned C directly.
 
+If any function called as part of a return list asks what its context
+is, it will be told it was called in list context regardless of the
+eventual binding of the returned C.  If that is not the
+desired behavior you must coerce the call to an appropriate context,
+(or declare the return type of the function to perform such a coercion).
+In any event, such a function is called only once at the time the
+C object is generated, not when it is later bound (which
+could happen more than once).
+
 =head2 The C function
 
 The C function returns an object that describes a particular 


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

2007-01-29 Thread Brandon S. Allbery KF8NH


On Jan 29, 2007, at 17:06 , [EMAIL PROTECTED] wrote:


+absense of context propagation by the optimizer).  The value returned


Minor spelling nit:  "absence"

--
brandon s. allbery[linux,solaris,freebsd,perl] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH





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

2007-01-29 Thread larry
Author: larry
Date: Mon Jan 29 17:41:22 2007
New Revision: 13547

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

Log:
typo from KF8NH++


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podMon Jan 29 17:41:22 2007
@@ -444,7 +444,7 @@
 within the dynamic scope of the C.  The C function's
 signature is like that of C; it merely captures the C
 of its argments without imposing any additional constraints (in the
-absense of context propagation by the optimizer).  The value returned
+absence of context propagation by the optimizer).  The value returned
 by the C to its own context is that same C object (which
 is ignored when the C is in void context).  Regardless of the
 C's context, the C object is also added to the list of


[perl #41373] Need test for Clone of HLL info

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


.. To replace the TODO'd one which relied on non-core Perl5 PMCs.

See t/pmc/threads.t
--
Will "Coke" Coleda
[EMAIL PROTECTED]




[perl #41374] test MMD with non-perl PMCs

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


To replace removal of Perl PMCs* from core: still should test this  
functionality.

See t/pmc/mmd.t
--
Will "Coke" Coleda
[EMAIL PROTECTED]




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

2007-01-29 Thread larry
Author: larry
Date: Mon Jan 29 21:05:36 2007
New Revision: 13548

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

Log:
More clarifications requested by thom++.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podMon Jan 29 21:05:36 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 23 Dec 2006
+  Last Modified: 29 Jan 2007
   Number: 2
-  Version: 82
+  Version: 83
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -646,9 +646,6 @@
 A variant of C<*> is the C<**> term.  It is generally understood to
 be a multidimension form of C<*> when that makes sense.
 
-The C<***> variant serves as the insertion point of a list of feeds.
-That insertion point may be targeted by feeding into C<*>.  See S06.
-
 Other uses for C<*> will doubtless suggest themselves over time.  These
 can be given meaning via the MMD system, if not the compiler.  In general
 a C should be interpreted as maximizing the degrees of freedom
@@ -673,12 +670,15 @@
 
 These can behave as values or objects of any class, except that
 C always returns false.  One can create them with the
-built-in C and C functions.  (See S02 for how failures
+built-in C and C functions.  (See S04 for how failures
 are handled.)
 
-Undef   Undefined (can serve as a prototype object of any class)
+Undef   Undefined (variants serve as prototype objects of classes)
 WhateverWildcard (like undef, but subject to do-what-I-mean via MMD)
-Failure Failure (throws an exception if not handled properly)
+Failure Failure (lazy exceptions, thrown if not handled properly)
+
+Whenever you declare any kind of type, class, module, or package, you're
+automatically declaring a undefined prototype value with the same name.
 
 =head2 Immutable types