From: Steffen Schwigon [mailto:[EMAIL PROTECTED]
> Thomas Wittek <[EMAIL PROTECTED]> writes:
> > Maybe we should steal the ruby "principle of least surprise" here,
> > which I find a very good principle.
>
> I'm quite confident that Larry already stole all good principles he
> could find.
Me too
HaloO,
Paul Hodges wrote:
so back to foo("bar"). What's the default behavior? String doesn't Num,
does it? though is does convert if the value is good
I think that Str and Num are disjoint mutually exclusive types.
If you want to get coercive behaviour you need an overloaded
&foo:(Str|Num
Thomas Wittek <[EMAIL PROTECTED]> writes:
> So it looks like we can hide several multis with one sub:
> [ example ]
Maybe the type system in Pugs is not yet in such a final state to
experiment with it in all that details. I can construct other examples
or "reverse engineer" the neighbor discussion
Steffen Schwigon:
> Thomas Wittek <[EMAIL PROTECTED]>:
>> Maybe I just phenomenally misunderstood multi subs, but unless I
>> did, I can't see why we want to have subs when we can have multi
>> subs that can do the same and even more.
>
> I understand your point and I confess I'm not sure.
>
> At
Thomas Wittek <[EMAIL PROTECTED]> writes:
> Steffen Schwigon schrieb:
>> At least the many keywords seem to be necessary to map the complexity
>> of different paradigms possible in Perl6. Multimethods are not just
>> overloading as in C++. Second, the different keywords declare
>> different behavio
so back to foo("bar"). What's the default behavior? String doesn't Num,
does it? though is does convert if the value is good
Does that mean foo("123") should or should not dispatch to foo(Int)?
Or even foo(Num), for that matter Oy, I could see some headaches
around setting these rules in
On Fri, Jun 23, 2006 at 09:11:44PM +0300, Markus Laire wrote:
> And what about other types?
> e.g. if String can't ever be "best candidate" for Int, then does that
> mean that neither can Int ever be "best candidate" for Num, because
> they are different types?
Well, I think Num and Int *aren't* d
I'm sending this also to perl6-language, in case someone there knows
an answer to this.
On 6/23/06, Jonathan Scott Duff <[EMAIL PROTECTED]> wrote:
I don't think so. I think the "best candidate" prose is about
choosing from types that have been specified, not autoconverting
between types such tha
Steffen Schwigon schrieb:
> At least the many keywords seem to be necessary to map the complexity
> of different paradigms possible in Perl6. Multimethods are not just
> overloading as in C++. Second, the different keywords declare
> different behaviour you can choose. Just read S06, it's explained
On Fri, Jun 23, 2006 at 06:55:28PM +0300, Markus Laire wrote:
> On 6/23/06, Jonathan Scott Duff <[EMAIL PROTECTED]> wrote:
> >An alternate interpretation would be that the last one is actually a
> >compile-
> >time error because none of the sigs match (Int,Int) and for a call to
> >work with 2 Int
Hi All,
I would like to thank everyone for their illuminating examples
and prose. This has cleared up understanding for me.
Thanks again,
Chris
On 6/23/06, Markus Laire <[EMAIL PROTECTED]> wrote:
On 6/23/06, Jonathan Scott Duff <[EMAIL PROTECTED]> wrote:
> An alternate interpretation would
On 6/23/06, Jonathan Scott Duff <[EMAIL PROTECTED]> wrote:
An alternate interpretation would be that the last one is actually a compile-
time error because none of the sigs match (Int,Int) and for a call to
work with 2 Int parameters, you'd need to be explicit:
talk(~123,3);
But I'm not sure wh
On Fri, Jun 23, 2006 at 06:18:51PM +0300, Markus Laire wrote:
> multi sub talk (String $msg1, String $msg2) { say "$msg1 $msg2" }
> multi sub talk (String $msg, Int $times) { say $msg x $times; }
> multi sub talk (String $msg, Num $times) { say "Please use an integer"; }
> multi sub talk (String $m
On 6/23/06, Steffen Schwigon <[EMAIL PROTECTED]> wrote:
Steffen Schwigon <[EMAIL PROTECTED]> writes:
> multi sub talk () { say 'Loose Talk Is Noose Talk.'; }
> multi sub talk (String $msg) { say $msg; }
> multi sub talk (String $msg, Int $times) { say $msg x $times; }
BTW, because we are j
> Multimethods are not just overloading as in C++.
To expand upon this point a little, you can use multimethods to do
pattern-matching in the style of ML and similar languages. So, to pinch
an example from the pugs tree (examples/functional/fp.p6)
multi sub length () returns Int { 0
Steffen Schwigon <[EMAIL PROTECTED]> writes:
> multi sub talk () { say 'Loose Talk Is Noose Talk.'; }
> multi sub talk (String $msg) { say $msg; }
> multi sub talk (String $msg, Int $times) { say $msg x $times; }
BTW, because we are just on-topic, can someone explain, when these
types above
"Chris Yocum" <[EMAIL PROTECTED]> writes:
> Hi All,
> At the risk of sounding a bit thick, I have a couple of questions
> about Perl6's multi keyword and mutilmethod in general. This seems
> like overloaded functions from C++ so why do we need a key word to
> declare them rather than using so
Hi All,
At the risk of sounding a bit thick, I have a couple of questions
about Perl6's multi keyword and mutilmethod in general. This seems
like overloaded functions from C++ so why do we need a key word to
declare them rather than using something like C++'s name mangling? Is
there somethin
18 matches
Mail list logo