Exegesis 4

2002-04-03 Thread Piers Cawley
Over on use.perl, someone spotted what looks like a bug in the example program which (if it *is* a bug) is fixed by using unary '*', but that's not what I'm writing about here. In the discussion of the yadda yadda yadda operator, Damian says that ... in this example, Err::BadData is *never*

Re: Exegesis 4

2002-04-03 Thread Damian Conway
Piers wrote: > Over on use.perl, someone spotted what looks like a bug in the example > program which (if it *is* a bug) is fixed by using unary '*', but > that's not what I'm writing about here. I'll admit I'm not sure whether it is a bug or not. I've asked Larry for clarification and will post

$_ aliasing

2002-04-03 Thread Uri Guttman
from exegesis 4: In Perl 6, the current topic -- whatever its name and however you make it the topic -- is always aliased to $_. and one of the examples is: for @list -> $next {# iterate @list, aliasing each element to # $next (and

Re: Exegesis 4

2002-04-03 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Piers wrote: > >> Over on use.perl, someone spotted what looks like a bug in the example >> program which (if it *is* a bug) is fixed by using unary '*', but >> that's not what I'm writing about here. > > I'll admit I'm not sure whether it is a bug or n

Re: Exegesis 4

2002-04-03 Thread Damian Conway
> Good oh. BTW, (and apologies for repeating the question I asked > elsewhere) are we going to see an updated Apocalypse 4 incorporating > all the changes made to get E4 to work? Probably not any time soon. Previous Apocalypses haven't been updated when changes were made. Eventually, of course,

Re: $_ aliasing

2002-04-03 Thread Damian Conway
Uri asked: > but what if there are multiple bound variables like this example: > > for %phonebook.kv -> $name, $number { > print "$name: $number\n" > } > > is $_ aliased to either/both/neither of the two topics? are those now > not topics but just aliased variabl

Apocrypha

2002-04-03 Thread Piers Cawley
So, I've been looking at the stuff in the Apocalypses and Exegeses so far and I think I've reached the point where I can have a crack at using perl 6 to implement another programming language. Coming (possibly) to a mailing list near you, Perl6::Scheme... -- Piers "It is a truth universally

Re: Exegesis 4

2002-04-03 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: >> Good oh. BTW, (and apologies for repeating the question I asked >> elsewhere) are we going to see an updated Apocalypse 4 incorporating >> all the changes made to get E4 to work? > > Probably not any time soon. Previous Apocalypses haven't been > updat

Re: Exegesis 4

2002-04-03 Thread Damian Conway
> > Eventually, of course, we'll have to go back and make eveything > > copacetic, but at the moment I think most folks would rather have us > > working on writing unwritten A's and E's, rather than rewriting > > written ones. ;-) > > Point. Maybe someone will step up to plate and do Perl 6 so fa

Re: Apocrypha

2002-04-03 Thread Damian Conway
> So, I've been looking at the stuff in the Apocalypses and Exegeses so > far and I think I've reached the point where I can have a crack at > using perl 6 to implement another programming language. Coming > (possibly) to a mailing list near you, Perl6::Scheme... "Be afraid. Be very afraid." ;-)

Nested whens?

2002-04-03 Thread Piers Cawley
Just a thought, I assume that something like the following will be legal: given $msg { when Message::ACK { $msg_store.fetch( $msg.acknowledged_msg ).set_state($msg); } when Message::SMS { when .is_incoming { ... } when .is_outgoin

Re: Exegesis 4

2002-04-03 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: >> > Eventually, of course, we'll have to go back and make eveything >> > copacetic, but at the moment I think most folks would rather have us >> > working on writing unwritten A's and E's, rather than rewriting >> > written ones. ;-) >> >> Point. Maybe

Re: Exegesis 4

2002-04-03 Thread Mark J. Reed
# Perl 5 code for (my $i=0; 1; $i++) { which would translate into Perl 6 as: loop (my $i=0; 1; $i++) { May I infer from this the return of loop-scoped variables (in which the loop control variable is magically inser

Re: Nested whens?

2002-04-03 Thread Larry Wall
Piers Cawley writes: : Just a thought, I assume that something like the following will be legal: : : given $msg { : when Message::ACK { : $msg_store.fetch( $msg.acknowledged_msg ).set_state($msg); : } : when Message::SMS { : when .is_incoming

Re: Exegesis 4

2002-04-03 Thread Larry Wall
Mark J. Reed writes: : : # Perl 5 code : for (my $i=0; 1; $i++) { : : which would translate into Perl 6 as: : : : loop (my $i=0; 1; $i++) { : : : May I infer from this the return of loop-scoped variables (in : which the loop control v

Re: Exegesis 4

2002-04-03 Thread John Siracusa
On 4/3/02 3:44 AM, Damian Conway wrote: > Larry indicated to me that blockless declarations of methods and subs > would be illegal. What's the motivation for this? It seems to me that pre-declarations would be just as nice (or nicer) as: module Alpha; package Beta; method Gamma::del

Re: Exegesis 4

2002-04-03 Thread Buddha Buck
At 07:57 AM 04-03-2002 -0800, Larry Wall wrote: >Mark J. Reed writes: >: loop (my $i=0; 1; $i++) { >: > >No, the scope of $i stays outside, per the previous decision. If you >want it inside you can always make $i an official formal parameter: > > for 0 .. Inf -> $i { ... } > >I t

RE: Exegesis 4

2002-04-03 Thread Brent Dax
John Siracusa: # On 4/3/02 3:44 AM, Damian Conway wrote: # > Larry indicated to me that blockless declarations of # methods and subs # > would be illegal. # # What's the motivation for this? It seems to me that # pre-declarations would # be just as nice (or nicer) as: # # module Alpha; #

Re: Exegesis 4

2002-04-03 Thread John Siracusa
On 4/3/02 12:07 PM, Brent Dax wrote: > John Siracusa: > # On 4/3/02 3:44 AM, Damian Conway wrote: > # > Larry indicated to me that blockless declarations of > # methods and subs would be illegal. > # > # What's the motivation for this? > > I assume it's to support the Perl 5 blockless style. Ah

$^a, $^b, and friends

2002-04-03 Thread John Siracusa
Reading EX4 and seeing those "place-holder" variables made me wonder what happens when someone (probably Damian ;) wants to use more than 26 of them. Do the place-holder names scale up as if they're being automagically incremented? (e.g. ..., y, z, aa, ab, ...) -John

Re: $^a, $^b, and friends

2002-04-03 Thread Jonathan Scott Duff
On Wed, Apr 03, 2002 at 12:41:13PM -0500, John Siracusa wrote: > Reading EX4 and seeing those "place-holder" variables made me wonder what > happens when someone (probably Damian ;) wants to use more than 26 of them. > Do the place-holder names scale up as if they're being automagically > incremen

Re: $^a, $^b, and friends

2002-04-03 Thread John Siracusa
On 4/3/02 12:49 PM, Jonathan Scott Duff wrote: > On Wed, Apr 03, 2002 at 12:41:13PM -0500, John Siracusa wrote: >> Reading EX4 and seeing those "place-holder" variables made me wonder what >> happens when someone (probably Damian ;) wants to use more than 26 of them. >> Do the place-holder names s

Re: Nested whens?

2002-04-03 Thread Melvin Smith
At 07:50 AM 4/3/2002 -0800, Larry Wall wrote: >Piers Cawley writes: >: Just a thought, I assume that something like the following will be legal: >: Yeah, it's not good style; I should really be doing >: >: $msg.dispatch_to($self) For some people (OO purists), switch statements are message dis

Re: $^a, $^b, and friends

2002-04-03 Thread Jonathan Scott Duff
On Wed, Apr 03, 2002 at 12:53:33PM -0500, John Siracusa wrote: > So it's the order that they appear that determines their binding? How would > something like this (Perl 5 code) be represented: > > sub reverse_minus { $_[1] - $_[0] } > > I would have guessed it'd be: > > { $^b - $^a } >

Re: $^a, $^b, and friends

2002-04-03 Thread Jonathan Scott Duff
On Wed, Apr 03, 2002 at 12:41:13PM -0500, John Siracusa wrote: > Reading EX4 and seeing those "place-holder" variables made me wonder what > happens when someone (probably Damian ;) wants to use more than 26 of them. > Do the place-holder names scale up as if they're being automagically > incremen

Exegesis 4: reduce?

2002-04-03 Thread Andrew Wilson
Hi I'm sure I'm missing something fairly fundamental, but could someone shed more light on the example: # reduce list three-at-a-time $sum_of_powers = reduce { $^partial_sum + $^x ** $^y } 0, @xs_and_ys; specifically what is being iterated over, what gets bound and what does it return? I tho

Re: $^a, $^b, and friends

2002-04-03 Thread Luke Palmer
On Wed, Apr 03, 2002 at 12:41:13PM -0500, John Siracusa wrote: > Reading EX4 and seeing those "place-holder" variables made me wonder what Where is EX4? It's not at perl.org... so... ??

Re: $^a, $^b, and friends

2002-04-03 Thread Jonathan Scott Duff
On Wed, Apr 03, 2002 at 12:19:13PM -0700, Luke Palmer wrote: > On Wed, Apr 03, 2002 at 12:41:13PM -0500, John Siracusa wrote: > > Reading EX4 and seeing those "place-holder" variables made me wonder what > > Where is EX4? It's not at perl.org... so... ?? Well, it's linked to from use.perl.org an

Re: $^a, $^b, and friends

2002-04-03 Thread Larry Wall
[EMAIL PROTECTED] writes: : On Wed, Apr 03, 2002 at 12:41:13PM -0500, John Siracusa wrote: : > Reading EX4 and seeing those "place-holder" variables made me wonder what : > happens when someone (probably Damian ;) wants to use more than 26 of them. : > Do the place-holder names scale up as if they

Re: $^a, $^b, and friends

2002-04-03 Thread Jonathan Scott Duff
On Wed, Apr 03, 2002 at 11:27:10AM -0800, Larry Wall wrote: > They are assumed to be declared in alphabetical order. Whoa! you say, > that could get confusing. It surely can. But if you're doing > something complicated enough that alphabetical order would be > confusing, don't use this shorthan

Re: $^a, $^b, and friends

2002-04-03 Thread Piers Cawley
Jonathan Scott Duff <[EMAIL PROTECTED]> writes: > On Wed, Apr 03, 2002 at 11:27:10AM -0800, Larry Wall wrote: >> They are assumed to be declared in alphabetical order. Whoa! you say, >> that could get confusing. It surely can. But if you're doing >> something complicated enough that alphabetic

Re: $^a, $^b, and friends

2002-04-03 Thread Larry Wall
Piers Cawley writes: : Jonathan Scott Duff <[EMAIL PROTECTED]> writes: : : > On Wed, Apr 03, 2002 at 11:27:10AM -0800, Larry Wall wrote: : >> They are assumed to be declared in alphabetical order. Whoa! you say, : >> that could get confusing. It surely can. But if you're doing : >> something c

Re: $^a, $^b, and friends

2002-04-03 Thread Damian Conway
Jonathan Scott Duff wrote: > > On Wed, Apr 03, 2002 at 12:41:13PM -0500, John Siracusa wrote: > > Reading EX4 and seeing those "place-holder" variables made me wonder what > > happens when someone (probably Damian ;) wants to use more than 26 of them. > > Do the place-holder names scale up as if

Re: Exegesis 4

2002-04-03 Thread Larry Wall
Buddha Buck writes: : At 07:57 AM 04-03-2002 -0800, Larry Wall wrote: : >Mark J. Reed writes: : >: loop (my $i=0; 1; $i++) { : >: : > : >No, the scope of $i stays outside, per the previous decision. If you : >want it inside you can always make $i an official formal parameter: : > : >

Re: $^a, $^b, and friends

2002-04-03 Thread Damian Conway
Piers Cawley wrote: > > Jonathan Scott Duff <[EMAIL PROTECTED]> writes: > > > On Wed, Apr 03, 2002 at 11:27:10AM -0800, Larry Wall wrote: > >> They are assumed to be declared in alphabetical order. Whoa! you say, > >> that could get confusing. It surely can. But if you're doing > >> something

Re: Exegesis 4: reduce?

2002-04-03 Thread Damian Conway
Andrew Wilson wrote: > I'm sure I'm missing something fairly fundamental, but could someone > shed more light on the example: > > # reduce list three-at-a-time > $sum_of_powers = reduce { $^partial_sum + $^x ** $^y } 0, @xs_and_ys; > > specifically what is being iterated over, what gets bound

Re: Exegesis 4: reduce?

2002-04-03 Thread Andrew Wilson
On Thu, Apr 04, 2002 at 09:37:19AM +1000, Damian Conway wrote: Ah yes, that makes a lot of sense. Thank you. Andrew

Re: Exegesis 4

2002-04-03 Thread Damian Conway
Mark J. Reed wrote: > > # Perl 5 code > for (my $i=0; 1; $i++) { > > which would translate into Perl 6 as: > > > loop (my $i=0; 1; $i++) { > > > May I infer from this the return of loop-scoped variables (in > which the loop control variab

Re: Exegesis 4

2002-04-03 Thread Bryan C. Warnock
On Wednesday 03 April 2002 18:24, Larry Wall wrote: > > Sure, just say > > { loop (my $i = intializer(); condition($i); $i = advance($i)) { ... } } > > : Perhaps something like: > : > : initalizer() -> $i { LOOP: NEXT { $i = advance($i); redo LOOP if > : condition($i);} ... } > : > : ex

Re: Exegesis 4

2002-04-03 Thread John Siracusa
On 4/3/02 6:44 PM, Damian Conway wrote: > Larry has said very clearly that in Perl 6 there are no "magical" lexical > scopes. Shouldn't this be: "Larry has said very clearly that in Perl 6 there is only one 'magical' lexical scope: sub() or ->" -John

Re: Exegesis 4

2002-04-03 Thread Luke Palmer
> Larry has said very clearly that in Perl 6 there are no "magical" lexical scopes. > That is, variables declared in a C control aren't magically in the > following block. However, I don't agree with him. It may be more intuitive to newcomers, but it is a common programming idiom that is used a

Re: Exegesis 4

2002-04-03 Thread Luke Palmer
> { > my @subs; > loop (my $x = 0; $x < 10; $x++) { > push @subs, { $^a + $x }; > } > $x--; > # ... > } > > This certainly does *not* DWIM in the current thought. And the silence > would be much more confusing than a simple syntax error the traditiona

The new =~, and chaining statement modifiers

2002-04-03 Thread Luke Palmer
So, does the new =~ commute now, except for regexps; i.e. $a =~ $b is the same as $b =~ $a unless one or both are regexps? Additionally, can you chain statement modifiers? do_this() if $a unless $b; print for @mylist if $debug; or less efficiently, print if $debug for @mylist; print "$

Re: The new =~, and chaining statement modifiers

2002-04-03 Thread Larry Wall
Luke Palmer writes: : So, does the new =~ commute now, except for regexps; i.e. : : $a =~ $b : is the same as : $b =~ $a : : unless one or both are regexps? I believe I marked which ones commute in A4. : Additionally, can you chain statement modifiers? : : do_this() if $a unless $b; : print f

Re: Exegesis 4

2002-04-03 Thread Larry Wall
[EMAIL PROTECTED] writes: : On 4/3/02 6:44 PM, Damian Conway wrote: : > Larry has said very clearly that in Perl 6 there are no "magical" lexical : > scopes. : : Shouldn't this be: "Larry has said very clearly that in Perl 6 there is only : one 'magical' lexical scope: sub() or ->" It's specific

Re: Exegesis 4

2002-04-03 Thread Larry Wall
[EMAIL PROTECTED] writes: : On Wednesday 03 April 2002 18:24, Larry Wall wrote: : > : > Sure, just say : > : > { loop (my $i = intializer(); condition($i); $i = advance($i)) { ... } : } : > : > : Perhaps something like: : > : : > : initalizer() -> $i { LOOP: NEXT { $i = advance($i); redo

Re: Exegesis 4

2002-04-03 Thread Damian Conway
Larry wrote: > > [EMAIL PROTECTED] writes: > : On 4/3/02 6:44 PM, Damian Conway wrote: > : > Larry has said very clearly that in Perl 6 there are no "magical" lexical > : > scopes. > : > : Shouldn't this be: "Larry has said very clearly that in Perl 6 there is only > : one 'magical' lexical scope

Re: Exegesis 4

2002-04-03 Thread Damian Conway
Larry explained: > : Umm. didn't you say bare blocks were going away? > > Rule #2 was invoked. > > The current thinking is that any bare block will never be interpreted > as returning a closure. You have to use explicit C or C > to return a closure. Or the equivalent of a C, namely:

Re: Exegesis 4

2002-04-03 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Larry explained: > >> : Umm. didn't you say bare blocks were going away? >> >> Rule #2 was invoked. >> >> The current thinking is that any bare block will never be interpreted >> as returning a closure. You have to use explicit C or C >> to retur