On Tue, Oct 30, 2001 at 04:29:15PM +1100, Damian Conway wrote:
I'd do that like so (using Larry's preferred syntax):
[...]
method INIT ($idval) { $.id := $idval }
Hm... that looks to me like a regular :=; is it?
Yep.
If so, what good is is const if
On Tue, Oct 30, 2001 at 03:59:30PM +1100, Damian Conway wrote:
(Though I *do* harbour a secret desire to resurrect - as a type specifier:
sub foo (@args) - rettype
Hmm... I would have expected is to come in here:
sub foo (@args) is IO::Handle
my $bar - int;
Hmm...
On Mon, Oct 29, 2001 at 04:16:24PM -0800, Larry Wall wrote:
[EMAIL PROTECTED] writes:
: 3. If you declare a method *without* any parameter list:
:
: method foo {...}
:
:then the method call arguments (including the invocant?)
:are bound to @_.
:
: Is
Okay, so we've got these guys auto-created if we want:
method foo is lvalue { return $.foo }
(plus or minus the syntax) which lets us do:
$obj.foo = 5;
print $obj.foo;
So, what about simple array accessors?
$obj.colors('red', 'green', 'blue');
$obj.colors = ('red',
John Siracusa:
# Okay, so we've got these guys auto-created if we want:
#
# method foo is lvalue { return $.foo }
#
# (plus or minus the syntax) which lets us do:
#
# $obj.foo = 5;
# print $obj.foo;
#
# So, what about simple array accessors?
Please note that these are my best
On 10/30/01 12:13 PM, Brent Dax wrote:
John Siracusa:
Please note that these are my best guesses; I'm not a Damian ;^).
# $obj.colors('red', 'green', 'blue');
#
# $obj.colors = ('red', 'green', 'blue');
#
# $obj.colors = ['red', 'green', 'blue' ];
$obj.colors=('red',
On Tue, Oct 30, 2001 at 12:27:32PM +1100, Damian Conway wrote:
($obj1, $obj2)-foo(@args);
Is that merely sugar for:
# errr, $_.foo(@args) ?
$_-foo(@args) foreach($obj1, $obj2);
No. What you showed would be achieved with either a hyperoperation:
Aaron wrote:
Cis const means: Once declared cannot be *assigned* to.
But that doesn't mean one can't *bind* a new value to the
variable (which would retain its Cconst-induced unassignability
after the binding).
I understand that. I guess what I'm saying is,
Aaron wrote:
sub foo (@args) - rettype
Hmm... I would have expected is to come in here:
sub foo (@args) is IO::Handle
It would have to be:
sub foo (@args) is type(IO::Handle)
or something, I think. Unless Larry decides that every class/module
name is
On Wed, 31 Oct 2001, Damian Conway wrote:
To me Cis const means: the *value* stored in the memory
implementing this variable cannot be changed. Which doesn't preclude
rebinding the variable to some *other* memory.
But others have a different (and equally reasonable) interpretation of
Cis
John asked:
So, what about simple array accessors?
Writing:
class Demo;
my @.colors is public;
gives you:
$obj.colors('red', 'green', 'blue');
No. $obj.colors() takes no arguments.
$obj.colors = ('red', 'green', 'blue');
Yes.
$obj.colors =
John icked:
# # Change apple color, but leave the blue berry
# $obj.fruit(apple = 'green');
#
# print $obj.fruit('apple'); # green
$obj.fruit{apple}
Icky, looks unencapsulated to me :)
[For the benefit of those playing along at home, the
method foo ( $me, $again : $big, $boy ) {...}
should be able to be called via either of:
foo $obj1, $obj2 : @args;
or:
($obj1, $obj2).foo(@args);
This stuff brings to mind all sorts of questions:
* If foo() is
Damian Conway:
# BTW, colon isn't an operator (it's a separator), so it can't be hyped.
What do you mean? We can hype the colon all we want! :^)
--Brent Dax
[EMAIL PROTECTED]
Configure pumpking for Perl 6
When I take action, Im not going to fire a $2 million missile at a $10
empty tent and
14 matches
Mail list logo