[EMAIL PROTECTED] wrote:
Would this work too?
0 but role {}
Most certainly, but you would have no way to refer to that role later,
so it is questionable how useful that construct is. No, it's not
questionable. That is a useless construct.
Luke
Can an inline role be named?
0
Miroslav Silovic skribis 2005-10-07 13:07 (+0200):
Can an inline role be named?
0 but role is_default {}
This is a nice idea. It would require named roles (and to really be
succesful, also classes, subs, methods, ...) declarations to be
expressions, but I see no downside to that.
Juerd
--
On 10/7/05, Juerd [EMAIL PROTECTED] wrote:
Miroslav Silovic skribis 2005-10-07 13:07 (+0200):
Can an inline role be named?
0 but role is_default {}
This is a nice idea. It would require named roles (and to really be
succesful, also classes, subs, methods, ...) declarations to be
Luke Palmer skribis 2005-10-07 15:31 (-0600):
Well, I see a cognitive downside. That is, package declarations (the
default) don't create closures. It's like this:
sub foo($x) {
sub bar() {
return $x;
}
return bar;
}
foo(42).(); #
On 10/7/05, Juerd [EMAIL PROTECTED] wrote:
Luke Palmer skribis 2005-10-07 15:31 (-0600):
sub foo($x) {
sub bar() {
return $x;
}
return bar;
}
foo(42).(); #
Does this mean that this Perl 5 snippet no longer does the same in
On Fri, Oct 07, 2005 at 03:46:02PM -0600, Luke Palmer wrote:
Uh no. Okay, when I said that they don't close, I guess I meant
they don't close like anonymous routines do. It works precisely like
Perl 5's:
sub foo {
my $foo = 5;
sub bar {
return $foo;
Cbut properties get attached to a value, and are available when the
value is passed to other functions/ etc. I would like to be able to
define a property of a value that is trapped in the lexical scope where
it is defined. The example that set me thinking down this path is
sub foo( $a, ?$b =
On 10/6/05, Dave Whipp [EMAIL PROTECTED] wrote:
sub foo( $a, ?$b = rand but :is_default )
{
...
bar($a,$b);
}
sub bar( $a, ?$b = rand but :is_default )
{
warn defaulting \$b = $b if $b.is_default;
...
}
It would be unfortunate if the is_default property attached in foo
Luke Palmer skribis 2005-10-06 14:23 (-0600):
my role is_default {} # empty
sub foo($a, ?$b = 0 but is_default) {...}
Would this work too?
0 but role {}
Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
On 10/6/05, Juerd [EMAIL PROTECTED] wrote:
Luke Palmer skribis 2005-10-06 14:23 (-0600):
my role is_default {} # empty
sub foo($a, ?$b = 0 but is_default) {...}
Would this work too?
0 but role {}
Most certainly, but you would have no way to refer to that role later,
10 matches
Mail list logo