Luke wrote:
Not that being explicit is always a bad thing:
$val = some_cond()
?? ($arg1 // $arg1_default)
// ($arg2 // $arg2_default)
No. What's a bad thing is creating new linguistic traps for when people
inevitably forget to be explicit.
And I question
On Tue, Sep 06, 2005 at 07:26:37AM +1000, Damian Conway wrote:
Thomas Sandlass wrote:
I'm still contemplating how to get rid of the :: in the
ternary
Comments?
I believe that the single most important feature of the ternary operator is
that it is ternary. That is, unlike an if-else
HaloO,
Luke wrote:
?? !! ain't bad either.
It's definitely much better that sabotaging the
(highly useful) // operator
within (highly useful) ternaries.
I guess the thing that I really think is nice is getting :: out of
that role and into the type-only domain.
Right. To make ::
On 9/6/05, Thomas Sandlass [EMAIL PROTECTED] wrote:
Right. To make :: indicate type or meta was my primary concern.
Okay, now why don't you tell us about this new binary :: you're proposing.
Luke
H. The arity of a given multi might be 3 or 4 or 5.
If *only* there were a way to return a single value that was simultaneously
any of 3 or 4 or 5.
Oh, wait a minute...
Damian
On 9/3/05, Damian Conway [EMAIL PROTECTED] wrote:
H. The arity of a given multi might be 3 or 4 or 5.
If *only* there were a way to return a single value that was simultaneously
any of 3 or 4 or 5.
Oh, wait a minute...
Well, we'd better document that pretty damn well then, and provide
Luke Palmer skribis 2005-09-06 13:28 (+):
Well, we'd better document that pretty damn well then, and provide
min_arity and max_arity, too.
Won't junctions do Array, then? I think foo.arity.max would be very
intuitive, and likewise, for @foo.arity { ... }
Juerd
--
HaloO,
Luke wrote:
Okay, now why don't you tell us about this new binary :: you're proposing.
Well, not a new one. Just plain old foo::bar::blahh and 'my ::blubb $x'
with relaxed whitespace rules. The ternary ?? :: is a splinter in my
mind's eye because it is not a compile time or symbol lookup
On Tue, Sep 06, 2005 at 13:28:24 +, Luke Palmer wrote:
This should still work:
sub map (code, [EMAIL PROTECTED]) {
gather {
my @args = @list.splice(0, code.arity);
take code([EMAIL PROTECTED]);
}
}
multi sub foo ( ... ) {
On Tue, Sep 06, 2005 at 04:57:30PM +0200, Thomas Sandlass wrote:
There's yet another approach, to make ternary listfix:
$val = $cond ?? true ?? false;
So
^^ that one
doesn't do the same thing as
^^ that one?
I'd find that confusing in itself.
On a related note:
Suppose I have a function with a non-obvious arity: I might, in a
desperate attempt to find billable hours, describe the arity as a trait:
sub sandwich($bread, $meat, $cheese, $condiment1, $qty1, ...)
does arity ({ 3 + 2 * any(1..Inf); });
That's cougheasy enough for
Hi,
# Perl 5
my @array_of_references = \($foo, $bar, $baz);
print [EMAIL PROTECTED];# prints 3
print ${ $array_of_references[1] }; # prints $bar
# Perl 6
my @array = \($foo, $bar, $baz);
say [EMAIL PROTECTED];
# 3 (like Perl 5)?
# Or 1, making \(...)
Hey all,
I recently added Package and Module into the MetaModel (2.0) so that
Package is an Object
Module is a Package
Class is a Module
as mentioned here
http://article.gmane.org/gmane.comp.lang.perl.perl6.language/4599.
Currently Packages have names and Modules add version and
Ingo Blechschmidt skribis 2005-09-06 19:46 (+0200):
If \(...) still constructs a list of references, are the following
assumptions correct?
IIRC, the RHS of \ is in scalar context, and the comma in scalar context
(the parens are just for precedence), creates an arrayref.
Which is interesting
Hi,
Juerd wrote:
Ingo Blechschmidt skribis 2005-09-06 19:46 (+0200):
If \(...) still constructs a list of references, are the following
assumptions correct?
IIRC, the RHS of \ is in scalar context, and the comma in scalar
context (the parens are just for precedence), creates an arrayref.
Luke wrote:
Well, we'd better document that [junctive arity values] pretty damn
well then, and provide min_arity and max_arity, too.
Unnecessary. The Cmax and Cmin builtins should be overloaded to Just
Work on junctive values:
if min code.arity 2 {...}
This is one of those places
16 matches
Mail list logo