On Fri, Dec 23, 2011 at 10:59:58PM +1100, Kris Shannon wrote:
> sub infix: ($a, $b = ($a foo 2 * 3 - $a)) is tighter(&infix:<*>)
> {
> $a == 0 ?? 1 foo 2 * 3 !! $a + $b
> }
>
> say 1 foo (2 * 3);
> # 7
> say (1 foo 2) * 3;
> # 9
>
> say 1 foo 2 * 3;
> # 9
>
> say infix:(1);
> # Niecza: 7
>
On Thu, Jan 15, 2009 at 10:52:55PM -0800, Mark Lentczner wrote:
> I'm re-working my "Periodic Table of the Operators" chart to be up-to-
> date. I did the first major pass based on S03-operators. However, the
> last few days I've been plowing through STD.pm and have discovered that
> there som
Mark Lentczner wrote:
> STD has sym<;> as both an infix operator ( --> Sequencer), and as a
> terminator.
> ?? Which is it? Since I think most people think of it as a statement
> terminator, I plan on leaving it off the chart.
It is both. Examples where it is used as an infix operator include:
On Thu, Oct 30, 2008 at 05:41:11PM +0100, Moritz Lenz wrote:
: Xiao Yafeng wrote:
: > Off the top of one's head, since there is no particular difference between
: > an operator and a function, can I see a function as a operator:
: >
: > (1, 2, 3, 4) >>elems<<(2, 3, 4, 5) #(2, 2, 2, 2)
: >
Xiao Yafeng wrote:
> Off the top of one's head, since there is no particular difference between
> an operator and a function, can I see a function as a operator:
>
> (1, 2, 3, 4) >>elems<<(2, 3, 4, 5) #(2, 2, 2, 2)
> (1, 2, 3, 4) >>shift<<(2, 3, 4, 5) #(2, 3, 4, 5)
But remember
iginal Message
From: David Brunton <[EMAIL PROTECTED]>
To: perl6-users@perl.org
Sent: Thursday, October 5, 2006 4:01:34 PM
Subject: Re: Operator overloading/Inheritance from built-in types?
Hopefully the following will help. If I've missed the thrust of your
questions, feel free to d
Hopefully the following will help. If I've missed the thrust of your
questions, feel free to disregard while someone else improves on my
answer :) I only overloaded the infix:<+> operator, but it should give
you an idea.
I would write the class comme ça:
use v6-alpha;
class Register {
has
On Sat, Sep 03, 2005 at 11:45:33 +0300, Yuval Kogman wrote a lot.
I'd like to summarize:
* if operators are not special than they are defined in perl 6
(maybe)
* if operators are defined in terms of other operators, then
overriding an operator may interfere with t
On Thu, Sep 01, 2005 at 17:12:51 +, Luke Palmer wrote:
> On 9/1/05, Yuval Kogman <[EMAIL PROTECTED]> wrote:
> > On Wed, Aug 31, 2005 at 13:43:57 -0600, Luke Palmer wrote:
> > > Uh yeah, I think that's what I was saying. To clarify:
> > >
> > > sub foo (&prefix:<+>) { 1 == 2 }# 1 and 2
On 9/1/05, Yuval Kogman <[EMAIL PROTECTED]> wrote:
> On Wed, Aug 31, 2005 at 13:43:57 -0600, Luke Palmer wrote:
> > Uh yeah, I think that's what I was saying. To clarify:
> >
> > sub foo (&prefix:<+>) { 1 == 2 }# 1 and 2 in numeric context
> > foo(&say); # nothing printed
> >
> > But
On Wed, Aug 31, 2005 at 13:43:57 -0600, Luke Palmer wrote:
> Uh yeah, I think that's what I was saying. To clarify:
>
> sub foo (&prefix:<+>) { 1 == 2 }# 1 and 2 in numeric context
> foo(&say); # nothing printed
>
> But:
>
> sub foo (&prefix:<+>) { +1 == +2 }
> foo(&say);
On 8/31/05, Yuval Kogman <[EMAIL PROTECTED]> wrote:
> On Wed, Aug 31, 2005 at 04:56:25 -0600, Luke Palmer wrote:
>
> > (That is, lexically binding &prefix:<+> does not change things in
> > numeric context; only when there's actually a + in front of them)
>
> Unless you override &prefix:<+> ?
>
>
On Wed, Aug 31, 2005 at 04:56:25 -0600, Luke Palmer wrote:
> (That is, lexically binding &prefix:<+> does not change things in
> numeric context; only when there's actually a + in front of them)
Unless you override &prefix:<+> ?
sub foo (&prefix:<+>) { +1 }
--
() Yuval Kogman <[EMAIL PROTECT
Markus Laire writes:
> [EMAIL PROTECTED] kirjoitti:
> >Please,
> >I have a question if exists in Perl somethink like keyword
> >'operator' in C++ ?
>
> That will exist in perl6.
And to quite a larger extent. Not only can you overload existing
operators, you can make up whatever operator name you
[EMAIL PROTECTED] kirjoitti:
Please,
I have a question if exists in Perl somethink like keyword
'operator' in C++ ?
That will exist in perl6.
for example we can write in C++ :
class A {
A() { printf("Constructor of object class A\n"); }
~A() { printf("Destructor of object class A\n"); }
};
A &opera
15 matches
Mail list logo