I notice that when I write a grammar, I end up doing this an awful lot
(in P::RD notation):
list: term ',' list { make_node(@item[0,1,3]) }
| term { $item[1] }
With attention on the actions, and assuming autotree is on.
In Perl 6, aside from the fact that there's a clearly
I know these were discussed to death not that long ago, but reading
Apocalypse 12 I had a query I couldn't remember if it had been covered
before or not, and I certainly don't recall seeing it in the Apocalypse,
although I've not read the entire thing with as much attention as I
might like yet
On Sat, Apr 17, 2004 at 11:52:19AM -0400, Austin Hastings wrote:
: Is it permissible to use variable dispatch for private methods?
Don't see why not, as long as the overhead of switching isn't imposed
on every method call.
: class Cerebellum {
: method :think() {...}
: method :ponder() {...}
Matthew Walton writes:
I know these were discussed to death not that long ago, but reading
Apocalypse 12 I had a query I couldn't remember if it had been covered
before or not, and I certainly don't recall seeing it in the Apocalypse,
although I've not read the entire thing with as much
Brent 'Dax' Royal-Gordon wrote:
chromatic wrote:
Perl.com has just made A12 available:
I started reading it last night, and ended up going to bed before I was
finished. But I just wanted to say that this:
With this dispatcher you can continue by saying next METHOD.
is the sort of
A12 mentions that C$foo.bar should return undef if C$foo is undef.
While I like the idea a lot, I don't think it should happen without
distinction. In fact, that's what I would most expect C.? to do, not
call a method if there is one, though that seems useful, too.
I'm just shooting in the dark
Luke Palmer wrote:
Matthew Walton writes:
But can I do
@things».=method();
Of course.
Excellent. Thankyou.
Not this time :-)
Next time then, probably.
Can anyone explain the rules of placeholder attachment? i.e., in the
example in Perl6::Placeholder's manpage,
grep { $data{$^value} } 1..10;
C$^value is clearly intended to attach to the outer closure C{
$data{$^value} }, not the inner closure C{$^value}. But how does the
compiler know?
Brent 'Dax' Royal-Gordon wrote:
chromatic wrote:
Perl.com has just made A12 available:
I started reading it last night, and ended up going to bed before I was
finished. But I just wanted to say that this:
With this dispatcher you can continue by saying next METHOD.
is the sort of
-Original Message-
From: Luke Palmer [mailto:[EMAIL PROTECTED]
Sent: Monday, 19 April, 2004 06:00 AM
To: Language List
Subject: A12 undef method calls
A12 mentions that C$foo.bar should return undef if C$foo is undef.
While I like the idea a lot, I don't think it should happen
-Original Message-
From: Mark A. Biggar [mailto:[EMAIL PROTECTED]
Brent 'Dax' Royal-Gordon wrote:
chromatic wrote:
Perl.com has just made A12 available:
I started reading it last night, and ended up going to bed before I was
finished. But I just wanted to say that
On Sat, Apr 17, 2004 at 01:07:44PM -0500, Abhijit A. Mahabal wrote:
: I do not understand one of the examples in the Use of methods/the dot
: notation section:
:
: $obj.method ($x + $y) + $z
:
: From the earlier examples (like $obj.method +1), I got the impression that
: you look ahead until you
On Mon, Apr 19, 2004 at 04:48:05AM -0600, Luke Palmer wrote:
: Trey Harris writes:
: Can anyone explain the rules of placeholder attachment? i.e., in the
: example in Perl6::Placeholder's manpage,
:
:grep { $data{$^value} } 1..10;
:
: C$^value is clearly intended to attach to the outer
On Mon, 19 Apr 2004, Larry Wall wrote:
On Sat, Apr 17, 2004 at 01:07:44PM -0500, Abhijit A. Mahabal wrote:
: $obj.method ($x + $y) + $z
:
: From the earlier examples (like $obj.method +1), I got the impression that
: you look ahead until you find a term or an operator. In the example above,
On Mon, Apr 19, 2004 at 10:37:57AM -0500, Abhijit A. Mahabal wrote:
: $obj.meth, - obviously not arguments
: $obj.meth $foo,$bar - obviously arguments
:
:
: $obj.meth() + $bat - obviosly not arguments
: $obj.meth () + $bat
In a message dated Mon, 19 Apr 2004, Larry Wall writes:
On Mon, Apr 19, 2004 at 04:48:05AM -0600, Luke Palmer wrote:
: Trey Harris writes:
: Can anyone explain the rules of placeholder attachment? i.e., in the
: example in Perl6::Placeholder's manpage,
:
:grep { $data{$^value} }
If we have a method that returns Dog if it returns anything at all, can we
say:
method foo returns Dog|undef {...}
In a similar vein, if the function reurns a dog or a refernce to an array
, can we use Dog|Array?
And is this legal:
given ($obj){
when Dog: ...
when Array: ...
No, obviously arguments. Okay, I see the problem. What you're missing
is that in an earlier Apocalypse, we said that postfix subscripts
and argument lists may not have an intervening space.
Oh, I see. Yes, I had missed that. Thanks for clearing that up.
--Abhijit
On Mon, Apr 19, 2004 at 11:44:24AM -0400, Dan Sugalski wrote:
: For that they leave it to lambda.weblogs.com to heap *educated* scorn
: and derision on things. :)
Hmm, well, in all their educatedness, they don't seem to have figured
out that the prototyping behavior they're looking for is
On Mon, Apr 19, 2004 at 11:00:33AM -0500, Abhijit A. Mahabal wrote:
: If we have a method that returns Dog if it returns anything at all, can we
: say:
:
: method foo returns Dog|undef {...}
Yes, but... You'd say that only if you wanted to allow a return
type that can be simultaneously Dog and
Trey Harris [EMAIL PROTECTED] wrote i
It's easy to just say don't nest placeholder-using closures, but that
doesn't seem workable in practice since every block is a closure, unless
placeholders are forbidden from all but the most trivial cases. Absurdly
trivial, it seems. How about
$sub
Abhijit A. Mahabal skribis 2004-04-19 11:00 (-0500):
when Dog: ...
when Array: ...
Shouldn't that be:
when Dog { ... }
when Array { ... }
Or is there some .when that I have not yet heard of?
Juerd
On Mon, Apr 19, 2004 at 08:57:47AM -0700, Trey Harris wrote:
: : It's easy to just say don't nest placeholder-using closures, but that
: : doesn't seem workable in practice since every block is a closure, unless
: : placeholders are forbidden from all but the most trivial cases. Absurdly
:
Abhijit A. Mahabal skribis 2004-04-19 11:00 (-0500):
when Dog: ...
when Array: ...
Shouldn't that be:
when Dog { ... }
when Array { ... }
Or is there some .when that I have not yet heard of?
Guilty as charged. My Perl6 is getting rusty...
--Abhijit
On Mon, Apr 19, 2004 at 07:01:34PM +0200, Juerd wrote:
: Abhijit A. Mahabal skribis 2004-04-19 11:00 (-0500):
: when Dog: ...
: when Array: ...
:
: Shouldn't that be:
:
: when Dog { ... }
: when Array { ... }
Yes, that's how it should be written.
: Or is there some .when that
Those with encyclopedic knowledge of the perl6-language list will recall my
impassioned, but ultimately futile plea for required named parameters--that
is, required arguments to a function that must be supplied as pairs rather
than positionally.
Here's a post from the middle of that old thread:
On 4/19/04 11:11 AM, Larry Wall wrote:
On Sat, Apr 17, 2004 at 01:12:58PM -0400, Austin Hastings wrote:
: If it's not totally obvious to everyone, you should download a copy of A12
: (I like the printer-friendly all-in-one-page version) as a hedge against
: the almost-inevitable slashdotting.
On Mon, Apr 19, 2004 at 09:42:14AM -0700, Dave Whipp wrote:
: Trey Harris [EMAIL PROTECTED] wrote i
: It's easy to just say don't nest placeholder-using closures, but that
: doesn't seem workable in practice since every block is a closure, unless
: placeholders are forbidden from all but the
On Mon, Apr 19, 2004 at 01:19:36PM -0400, John Siracusa wrote:
: On 4/19/04 11:11 AM, Larry Wall wrote:
: On Sat, Apr 17, 2004 at 01:12:58PM -0400, Austin Hastings wrote:
: : If it's not totally obvious to everyone, you should download a copy of A12
: : (I like the printer-friendly
On Mon, Apr 19, 2004 at 01:14:57PM -0400, John Siracusa wrote:
: I know we are running out of special characters, but I really, really think
: that required named parameters are a natural fit for many common APIs. A12
: has reinforced that belief. Save me, Dami-Wan Wallnobi, you're my only
:
At 1:14 PM -0400 4/19/04, John Siracusa wrote:
I know we are running out of special characters, but I really, really think
that required named parameters are a natural fit for many common APIs.
Well... maybe, but ponder a likely common case--automatically
redelegated initialization methods with
On 4/19/04 1:30 PM, Larry Wall wrote:
On Mon, Apr 19, 2004 at 01:14:57PM -0400, John Siracusa wrote:
: I know we are running out of special characters, but I really, really think
: that required named parameters are a natural fit for many common APIs. A12
: has reinforced that belief. Save
On Mon, Apr 19, 2004 at 10:30:18AM -0700, Larry Wall wrote:
On Mon, Apr 19, 2004 at 01:14:57PM -0400, John Siracusa wrote:
: I know we are running out of special characters, but I really, really think
: that required named parameters are a natural fit for many common APIs. A12
: has
On 4/19/04 1:41 PM, Dan Sugalski wrote:
At 1:14 PM -0400 4/19/04, John Siracusa wrote:
I know we are running out of special characters, but I really, really think
that required named parameters are a natural fit for many common APIs.
Well... maybe, but ponder a likely common
Quoting A12...
Note that an attribute declaration of the form
has Tail $wagger .= new(...)
might not do what you want done when you want it done, if what you
want done is to create a new Dog object each time an object is built.
For that you'd have to say:
has Tail $wagger = {
From page 7:
In any event, strings are reserved for other object layouts. We could
conceivably have things like:
return $class.bless(Cstruct, *%_);
So as it happens, 0 is short for the layout P6opaque.
I feel like we have pretty well staked out the letters p-e-r-l, but
anything else is
At 1:50 PM -0400 4/19/04, John Siracusa wrote:
On 4/19/04 1:41 PM, Dan Sugalski wrote:
At 1:14 PM -0400 4/19/04, John Siracusa wrote:
I know we are running out of special characters, but I really, really think
that required named parameters are a natural fit for many common APIs.
Well...
John Siracusa skribis 2004-04-19 14:20 (-0400):
has $.gender is rw;
(...)
This works well for a while, but then I decide to update Dog so that setting
the name also sets the gender.
$dog.name = 'Susie'; # also sets $dog.gender to 'female'
How do I write such a name() method? Do I
On Mon, Apr 19, 2004 at 01:02:36PM -0500, Jonathan Scott Duff wrote:
: Quoting A12...
: Note that an attribute declaration of the form
:
: has Tail $wagger .= new(...)
:
: might not do what you want done when you want it done, if what you
: want done is to create a new Dog object each
On Mon, Apr 19, 2004 at 02:04:55PM -0400, John Siracusa wrote:
: From page 7:
:
: In any event, strings are reserved for other object layouts. We could
: conceivably have things like:
:
: return $class.bless(Cstruct, *%_);
:
: So as it happens, 0 is short for the layout P6opaque.
:
: I
On 4/19/04 3:36 PM, Larry Wall wrote:
On Mon, Apr 19, 2004 at 02:04:55PM -0400, John Siracusa wrote:
: So, how about Perl6opaque (or Perl6Opaque), just to be safe :)
How 'bout just Opaque, meaning Parrot's native object type, or whatever
the native opaque type is for the platform in
-Original Message-
From: John Siracusa [mailto:[EMAIL PROTECTED]
Sent: Monday, 19 April, 2004 02:21 PM
To: Perl 6 Language
Subject: A12: default accessors and encapsulation
Let's say I have a class with some attributes:
class Dog;
has $.name is rw;
has $.age is
On 4/19/04 3:58 PM, Austin Hastings wrote:
I initially decide to accept the default accessors.
$dog.name = 'Ralph';
print $dog.age;
This works well for a while, but then I decide to update Dog so that setting
the name also sets the gender.
$dog.name = 'Susie'; # also sets
Miércoles 14 Abril 2004 14:18, Juerd wrote:
I propose to use ` as a simple hash subscriptor, as an alternative
to {} and . It would only be useable for \w+ keys or perhaps
-?\w+. As with methods, a simple atomic (term exists only in
perlreftut, afaix, but I don't know another word to describe
Angel Faus skribis 2004-04-19 22:43 (+0200):
If we really need a ultra-huffman encoding for hash subscriptors, I
have always dreamt of being able to do:
%hash/key
$hashref/foo/bar/baz/quux
...
I'd hate to give up dividing slash. It's one of the few operators that I
sometimes type
[EMAIL PROTECTED] (Juerd) writes:
Angel Faus skribis 2004-04-19 22:43 (+0200):
If we really need a ultra-huffman encoding for hash subscriptors, I
have always dreamt of being able to do:
%hash/key
$hashref/foo/bar/baz/quux
...
I'd hate to give up dividing slash. It's one of the few
Sean O'Rourke skribis 2004-04-19 15:11 (-0700):
I'd hate to give up dividing slash. It's one of the few operators that I
sometimes type without whitespace. Simple because 1/10 is good enough
and 1 / 10 is very wide.
You can have both, though.
But not in a way that makes $foo/$bar divide
[EMAIL PROTECTED] (Juerd) writes:
Sean O'Rourke skribis 2004-04-19 15:11 (-0700):
I'd hate to give up dividing slash. It's one of the few operators that I
sometimes type without whitespace. Simple because 1/10 is good enough
and 1 / 10 is very wide.
You can have both, though.
But not in
On Mon, Apr 19, 2004 at 03:34:13PM -0700, Sean O'Rourke wrote:
in a '/' is a regex, anything otherwise is a hash slice.
I don't understand. Could you give some examples? Is this in the context
of bare /path/to/foo, even?
/foo/ # trailing slash -- so it's a regexp (m/foo/)
/foo\/bar/ #
Sean O'Rourke skribis 2004-04-19 15:34 (-0700):
I'm saying division is now defined such that when the numerator is
a hash(-ref), the result is the set of values associated with the
denominator. I've never tried to divide a hash or hashref by
something without it being a bug.
I understand
On 4/19/04 4:47 PM, [EMAIL PROTECTED] wrote:
On 4/19/04 3:58 PM, Austin Hastings wrote:
One work-around might be an alternate kind of default accessor that doesn't
allow assignment:
$dog.name # get
$dog.name('foo') # set
$dog.name = 'foo' # compile-time error
I
John Siracusa writes:
On 4/19/04 3:58 PM, Austin Hastings wrote:
I initially decide to accept the default accessors.
$dog.name = 'Ralph';
print $dog.age;
This works well for a while, but then I decide to update Dog so that setting
the name also sets the gender.
52 matches
Mail list logo