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*
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
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
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 not. I've
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,
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 variables?
In a
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
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
updated when
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 far in a
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
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 someone will step
exegesis4
# Perl 5 code
for (my $i=0; 1; $i++) {
which would translate into Perl 6 as:
loop (my $i=0; 1; $i++) {
/exegesis4
May I infer from this the return of loop-scoped variables (in
which the loop control
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
Mark J. Reed writes:
: exegesis4
: # Perl 5 code
: for (my $i=0; 1; $i++) {
:
: which would translate into Perl 6 as:
:
:
: loop (my $i=0; 1; $i++) {
: /exegesis4
:
: May I infer from this the return of loop-scoped variables (in
:
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
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;
#
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, yeah,
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
incremented?
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
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
incremented?
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
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... ??
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 and
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 shorthand.
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
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 they're
Buddha Buck writes:
: At 07:57 AM 04-03-2002 -0800, Larry Wall wrote:
: Mark J. Reed writes:
: : loop (my $i=0; 1; $i++) {
: : /exegesis4
:
: 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:
:
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 complicated
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 and
On Thu, Apr 04, 2002 at 09:37:19AM +1000, Damian Conway wrote:
a really clear explanation
Ah yes, that makes a lot of sense. Thank you.
Andrew
Mark J. Reed wrote:
exegesis4
# Perl 5 code
for (my $i=0; 1; $i++) {
which would translate into Perl 6 as:
loop (my $i=0; 1; $i++) {
/exegesis4
May I infer from this the return of loop-scoped variables (in
which the loop
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);} ... }
:
: except I'm
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
Larry has said very clearly that in Perl 6 there are no magical lexical scopes.
That is, variables declared in a Cloop 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
{
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 traditional
way with
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 $x,
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
[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 specifically
[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 LOOP if
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 Creturn {} or Csub {}
to return a closure.
Or the equivalent of a Csub
40 matches
Mail list logo