Re: Delegation

2021-11-26 Thread Elizabeth Mattijsen
By the way: if you override an operator, you can still access the original one using CORE:: sub infix:<+>($,$) { 42 } say 200 + 300; # 42 say infix:<+>(200,300); # 42 say &CORE::infix:<+>(200,300); # 500 > On 26 Nov 2021, at 20:30, rir wrote: > > Wow,

Re: Delegation

2021-11-26 Thread Elizabeth Mattijsen
You mean like: say &infix:<+>(has 42,137); # 179 ?? If so, by referring to its full name :-) > On 26 Nov 2021, at 15:07, rir wrote: > > Is it possible to to delegate plain or overridden operators? If so, > what does the syntax look like? > > Rob

Delegation

2021-11-26 Thread rir
Is it possible to to delegate plain or overridden operators? If so, what does the syntax look like? Rob

[perl #124007] [BUG] method delegation doesn't work in roles

2017-12-03 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
Still reproducible (2017.11,HEAD(e5b660e)) On 2015-03-06 14:35:06, rayd...@cyberuniverses.com wrote: > As seen at http://irclog.perlgeek.de/perl6/2015-03-06#i_10237611 : > > r: role R { method foo () handles { } } > rakudo-moar 1b74e4: OUTPUT«===SORRY!=== Error while compiling > /tmp/tmpfile␤Meth

delegation

2015-10-07 Thread mt1957
Hi, According to synopsis 12 I could defer methods to methods in another object. The case in which one can map some name into another didn't work out. * ** **class A {** ** method say-i (Int $i ) { say "I: $i"; }** **}** ** **class B {** ** has A $.n handles { :x };** ** ** submethod BUILD { $

[perl #124007] [BUG] method delegation doesn't work in roles

2015-03-06 Thread via RT
# New Ticket Created by # Please include the string: [perl #124007] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=124007 > As seen at http://irclog.perlgeek.de/perl6/2015-03-06#i_10237611 : r: role R { method foo () handles

[perl #95514] [BUG] Bogus error message about not enough positional parameter when role method calls another after a role method delegation in Rakudo

2014-02-20 Thread Will Coleda via RT
test added by peschwa++, closing ticket. -- Will "Coke" Coleda

[perl #95514] [BUG] Bogus error message about not enough positional parameter when role method calls another after a role method delegation in Rakudo

2012-08-05 Thread Carl Mäsak via RT
($x) { say "OH HAI" }; method foo > { > > self.bar(42) } }; R.new.foo > > rakudo 922500: OUTPUT«OH HAI␤» > > and it seems that, somehow, the role method delegation is > > necessary to trigger it. > > The second variant no longer errors. If you

[perl #95514] [BUG] Bogus error message about not enough positional parameter when role method calls another after a role method delegation in Rakudo

2012-05-27 Thread Will Coleda via RT
ram body at line > 22:/tmp/N060_2D3In␤» > * masak submits rakudobug > only the order of the method declarations in the role differs. > rakudo: role R { method bar($x) { say "OH HAI" }; method foo { > self.bar(42) } }; R.new.foo > rakudo 922500: OUTPUT«OH HAI␤» > and it s

[perl #67324] [BUG] 'handles' delegation doesn't quite work when calling type objects in Rakudo

2011-09-14 Thread jn...@jnthn.net via RT
On Wed Jul 08 03:59:21 2009, masak wrote: > rakudo: class A { method foo {"A.foo"} }; class C { has A $.a > handles *; }; my C $c .= new; say C.foo > rakudo 70bfd5: OUTPUT«Method 'foo' not found for invocant of > class ''␤» > NYI? > I'm sure we had tests for handles * > oh > rakudo: class A {

[perl #95514] [BUG] Bogus error message about not enough positional parameter when role method calls another after a role method delegation in Rakudo

2011-07-24 Thread Carl Mäsak
{ say "OH HAI" }; method foo { self.bar(42) } }; R.new.foo rakudo 922500: OUTPUT«OH HAI␤» and it seems that, somehow, the role method delegation is necessary to trigger it.

[perl6/specs] 75b4ff: Defer wildcard delegation to dispatch failover

2011-01-05 Thread noreply
Message: --- Defer wildcard delegation to dispatch failover Wildcard delegation should not be used for methods that are in the object's own ancestry (especially .new). Use explicit delegation or mixins to acquire such methods. Commit: af947e981ca92e316a4841a022b52f23230e464f

[perl #75966] [BUG] Strange error when doing 'handles' delegation with a parameter in Rakudo

2010-06-23 Thread Carl Mäsak via RT
rakudo: class A { method foo(|$c) { say $c.perl } }; A.foo rakudo ad2afb: OUTPUT«\()␤» rakudo: class A { method foo(|$c) { say $c.perl } }; A.foo(1) rakudo ad2afb: OUTPUT«Too many positional parameters passed; got 2 but expected 2␤ in 'A::foo' at line 11:/tmp/TE5FBvA4r9 [...] Golfed. * masa

[perl #75966] [BUG] Strange error when doing 'handles' delegation with a parameter in Rakudo

2010-06-23 Thread Carl Mäsak
# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #75966] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=75966 > rakudo: class A { method foo($x) { say "OH $x" } }; class B { has $.a handles }; B.new

[perl #67324] [BUG] 'handles' delegation doesn't quite work when calling type objects in Rakudo

2009-07-08 Thread Carl Mäsak
# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #67324] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=67324 > rakudo: class A { method foo {"A.foo"} }; class C { has A $.a handles *; }; my C $c .=

Re: S12 delegation ("handles" trait)

2008-04-18 Thread John M. Dlugosz
ot a perl 6.0.0 feature, but something that it shouldn't be too difficult to add later) would be a way to tell the delegation to pass "self" as an extra arg to the delegate method. The |$args does include the $self as the first argument. The syntax tail.wag(|$args) will star

S12 delegation ("handles" trait)

2008-04-18 Thread Dave Whipp
I noted Jonathan Worthington's work implementing the "handles" trait for delegation through attributes, and was a bit surprised to see that it is defined (S12/delegation) to use strings instead of method signatures -- I had thought that perl6 was attempting to be symbolic in plac

Re: [perl #31050] [PATCH] Exception handling bugfix on failed delegation

2004-08-13 Thread Leopold Toetsch
Felix Gallo (via RT) wrote: Synopsis: in CVS as of Tue Aug 10 17:30:52 EDT 2004, the examples/japh/japh[4,5,6,9].pasm examples all crash with segmentation fault on my highly hacked up linux box. Ah, yep thanks. They arguably should be working fine. IO changes WRT output line-buffering made thread-

[perl #31050] [PATCH] Exception handling bugfix on failed delegation

2004-08-13 Thread via RT
# New Ticket Created by Felix Gallo # Please include the string: [perl #31050] # in the subject line of all future correspondence about this issue. # http://rt.perl.org:80/rt3/Ticket/Display.html?id=31050 > Synopsis: in CVS as of Tue Aug 10 17:30:52 EDT 2004, the examples/japh/japh[4,5,6,9].p

Re: A12: Delegation using arrays

2004-04-23 Thread Larry Wall
On Fri, Apr 23, 2004 at 03:13:09PM -0400, Austin Hastings wrote: : Can I declare a const reference and have it optimized away? : : class Queue { : has @:elements; : has $:array_delegate : handles : = \@:elements : is const; : } I suppose, depending on what you mean

RE: A12: Delegation using arrays

2004-04-23 Thread Austin Hastings
d it shouldn't have to > go poking down through a reference to get at that list. It has a valid > use for the @ sigil. Aha! A light comes on: Delegation is not the same as subordination. The C delegation syntax declares "formal" delegation, meaning that the handler

Re: A12: Delegation using arrays

2004-04-23 Thread Larry Wall
On Fri, Apr 23, 2004 at 02:07:16PM -0400, Austin Hastings wrote: : I guess I'm more strongly attached to the sigil than I realized. IMO, if you : have : : $obj handles 'a'; : : and put an arrayref in $obj, then you get what's coming: iteration. But if : you have : : @obj handles 'a'; : : th

Re: A12: Delegation using arrays

2004-04-23 Thread Larry Wall
On Fri, Apr 23, 2004 at 10:39:33AM -0700, Larry Wall wrote: : On the other hand, maybe making %:handlers special is wrong, and it I meant @:handlers there, of course. We all seem to be having a little trouble with syntax today, doesn't us? Larry

RE: A12: Delegation using arrays

2004-04-23 Thread Austin Hastings
> -Original Message- > From: Larry Wall [mailto:[EMAIL PROTECTED] > > On Fri, Apr 23, 2004 at 01:15:51PM -0400, Austin Hastings wrote: > : A12 sez: > : > : If your delegation object happens to be an array: > : > : has @:handlers handles 'foo';

Re: A12: Delegation using arrays

2004-04-23 Thread Larry Wall
On Fri, Apr 23, 2004 at 11:28:02AM -0600, Luke Palmer wrote: : Though the hash "handles" handler hardly seems useful to me. Perhaps : someone can explain what that's intended to accomplish. No idea. It just seemed like it ought to be made to mean something. On the other hand, maybe making %:han

Re: A12: Delegation using arrays

2004-04-23 Thread Larry Wall
On Fri, Apr 23, 2004 at 01:15:51PM -0400, Austin Hastings wrote: : A12 sez: : : If your delegation object happens to be an array: : : has @:handlers handles 'foo'; : : then something cool happens. In this case : Perl 6 assumes that your array contains a list of potential :

Re: A12: Delegation using arrays

2004-04-23 Thread Luke Palmer
Austin Hastings writes: > A12 sez: > > If your delegation object happens to be an array: > > has @:handlers handles 'foo'; > > then something cool happens. In this case > Perl 6 assumes that your array contains a list of potential > handlers, an

A12: Delegation using arrays

2004-04-23 Thread Austin Hastings
A12 sez: If your delegation object happens to be an array: has @:handlers handles 'foo'; then something cool happens. In this case Perl 6 assumes that your array contains a list of potential handlers, and you just want to call the first one that succeeds. This is not

Re: Delegation syntax

2002-10-11 Thread Ralph Mellor
> [proposal for delegation syntax, drawing from Class::Delegation] > > If something is part of the method interface, it ought to be declared > as a method. > > method steer is really(Wheel) is also(???) { .profit!!! } That's tidy, and is sorta on the lines of my own

Re: Delegation syntax

2002-10-10 Thread Larry Wall
: Problem: : : You want to use delegation rather than inheritance to : add some capabilities of one class or object to : another class or object. : : Solution: : : Use a PROXY block: : : class MyClass { : : PROXY { : attr $left_front_wheel is Wheel; : attr

Delegation syntax

2002-10-10 Thread Ralph Mellor
Problem: You want to use delegation rather than inheritance to add some capabilities of one class or object to another class or object. Solution: Use a PROXY block: class MyClass { PROXY { attr $left_front_wheel is Wheel; attr $right_front_wheel is Wheel

Delegation syntax

2002-10-10 Thread Me
Problem: You want to use delegation (rather than inheritance) to add some capabilities of one class or object to another class or object. Solution: Use a PROXY block: class MyClass { PROXY { attr $left_front_wheel is Wheel; attr $right_front_wheel is Wheel

RE: Delegation syntax? (was: Re: Private contracts)

2002-10-04 Thread Garrett Goebel
John Williams: > Reaction #2: Inheritance would automatically delegate all those > methods, so again, in what way does inheritance _not_ solve > the problem? What about when you want to be able to dynamically swap the objects to which you're delegating? -- Garrett Goebel IS Development Special

Re: Delegation syntax?

2002-10-04 Thread Dan Sugalski
At 12:37 AM -0400 10/4/02, Michael G Schwern wrote: >Delegation is a basic OO technique. We definately should have fast, >well-designed core support for it. I'm pretty sure we will. I certainly need it internally... --

Re: Delegation syntax? (was: Re: Private contracts)

2002-10-04 Thread Andy Wardley
ct inherits all the methods that you don't explicity re-define. With interfaces, you are stating that your object will implement all the methods, either directly or by inheriting from, or delegating to other classes. Thus, inheritance, delegation and interfaces are separate, orthogon

Re: Delegation syntax?

2002-10-03 Thread Michael G Schwern
On Fri, Oct 04, 2002 at 12:28:29AM -0400, Trey Harris wrote: > I think my point here is that there are clearly places where we need > stronger built-in support in Perl of some OO concepts. Delegation may not > be one of them--it's easy enough to graft on, and TMTOWTDI may

Re: Delegation syntax? (was: Re: Private contracts)

2002-10-03 Thread Michael G Schwern
On Thu, Oct 03, 2002 at 07:59:33PM -0600, John Williams wrote: > Reaction #2: Inheritance would automatically delegate all those > methods, so again, in what way does inheritance _not_ solve the problem? I don't think p6l is the right place to discuss the merits of delegation, let

Re: Delegation syntax?

2002-10-03 Thread Trey Harris
In a message dated Thu, 3 Oct 2002, Michael Lazzaro writes: > On Thursday, October 3, 2002, at 04:25 PM, Michael G Schwern wrote: > > Class::Delegation? > > Yeah, it's one of the best I've seen: it makes sense, does everything I > want, and is easy to explain even

Re: Delegation syntax? (was: Re: Private contracts)

2002-10-03 Thread John Williams
On Thu, 3 Oct 2002, Michael Lazzaro wrote: > > 1) Delegation through inheritance: > (a.k.a. "mixin" classes, "hard delegation", "concrete interfaces", > etc., etc.) > > Example: I want to say that a class DataManager has the capabil

Re: Delegation syntax?

2002-10-03 Thread Michael Lazzaro
lly ever liked. > > Class::Delegation? Yeah, it's one of the best I've seen: it makes sense, does everything I want, and is easy to explain even to newbies. The perl5 hash-based syntax is still pretty scary, tho. Dunno, I keep wishing for something that's a one-li

Re: Delegation syntax? (was: Re: Private contracts)

2002-10-03 Thread Michael G Schwern
On Thu, Oct 03, 2002 at 03:54:09PM -0700, Michael Lazzaro wrote: > I have no *good* syntax proposals for this, I don't think I've ever > seen the problem solved with syntax that I really ever liked. Class::Delegation? -- Michael G. Schwern <[EMAIL

Delegation syntax? (was: Re: Private contracts)

2002-10-03 Thread Michael Lazzaro
n D&E. Oh, thank God. I was hoping people would say that. OK, for an entirely different thread... Is there an accepted preliminary syntax for OO delegation? (I've looked and can't find anything definitive.) By "delegation", I mean two different things (you can tell OO p

RFC 193 (v2) Objects : Core support for method delegation

2000-09-25 Thread Perl6 RFC Librarian
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Objects : Core support for method delegation =head1 VERSION Maintainer: Damian Conway <[EMAIL PROTECTED]> Date: 4 Sep 2000 Last Modified: 25 Sep 2000 Mailing List: [EMAIL PROTECTED] Numbe

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread Damian Conway
> > When you want to turn off an inherited delegation in an ISA situation? > > Um, I don't think I understand the question. I'm confused by the question, too. > Delegation is not inherited. Any module you inherit from you won't > use f

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread David E. Wheeler
"David L. Nicol" wrote: > > When you want to turn off an inherited delegation in an ISA situation? Um, I don't think I understand the question. Delegation is not inherited. Any module you inherit from you won't use for delegation, AFAIK. They're two different be

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread David L. Nicol
When you want to turn off an inherited delegation in an ISA situation? "David E. Wheeler" wrote: > > Damian Conway wrote: > > > Err, that *is* the default behaviour. Delegation doesn't occur unless > > you specify it. Or am I missing your meaning h

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread Damian Conway
> use delegation > attr1 => [qw( method1 method2 method3 )], > attr2 => [qw( method4 method5 )], > attr3 => __ALL__, # Use all of them. > attr4 => []; # Use none of them. > > Yes, I realize that not putting attr4 in there

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread David E. Wheeler
Damian Conway wrote: > Err, that *is* the default behaviour. Delegation doesn't occur unless > you specify it. Or am I missing your meaning here? use delegation attr1 => [qw( method1 method2 method3 )], attr2 => [qw( method4 method5 )], attr3 => __ALL_

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread Damian Conway
> > Unless you change the default behavio[u]r to "don't delegate any method > calls to this object!". Err, that *is* the default behaviour. Delegation doesn't occur unless you specify it. Or am I missing your meaning here? Damian

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread David E. Wheeler
Damian Conway wrote: > > Stupid, stupid, stupid! Of course, that should be: > > attr3 => __ALL__ > > and then delegated methods can be named any(crazy)thing. Damn, Damian, don't be so hard on yourself! You're right about __ALL__, of course, but I suspect that most of us would have a pr

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread David E. Wheeler
Damian Conway wrote: > It was (and is) a good suggestion. I suspect however that it should be > > attr3 => [__ALL__] > > so that classes can still have an C method delegated. > (Yes, now they can't have an C<__ALL__> method, > but maybe that's a Good Thing ;-) Agreed. Yes, that's very goo

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread Nathan Wiger
Damian Conway wrote: > >> attr3 => [ALL] > > It was (and is) a good suggestion. I suspect however that it should be > > attr3 => [__ALL__] Any consideration given to the :all export-like tag? attr3 => [:all]# could be uppercase too -Nate

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread Damian Conway
Too early in the morning, I wrote: >> I might like to see something like URI suggested: >> >> attr3 => [ALL] > > It was (and is) a good suggestion. I suspect however that it should be > > attr3 => [__ALL__] > > so that classes can still have an C

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread Damian Conway
> When I see those empty arrayrefs, I think "delegate to *no* methods in > those classes stored in attr3 and att4," rather than "delegate all > method calls to those attributes." Just in the name of greater clarity, > I might like to see something like URI suggested: > > attr3

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread Damian Conway
> Is this not just a module which creates the necessary subs in the calling > package ? The catchall can be done with an AUTOLOAD sub. That's certainly how Class::Delegation is implemented. It isn't quite adequate however, because if you trigger the AUTOLOAD and it *fa

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread David E. Wheeler
Perl6 RFC Librarian wrote: > > This and other RFCs are available on the web at > http://dev.perl.org/rfc/ > > =head1 TITLE > > Objects : Core support for method delegation This idea rocks, Damian! I want it now! Just one suggestion, however... > The proposed delegat

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread Graham Barr
On Mon, Sep 04, 2000 at 09:53:39PM -, Perl6 RFC Librarian wrote: > The proposed delegation mechanism would work via a pragma: > > use delegation > attr1 => [qw( method1 method2 method3 )], > attr2 => [qw( method4 method5 )],

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread Piers Cawley
Michael G Schwern <[EMAIL PROTECTED]> writes: > On Mon, Sep 04, 2000 at 09:53:39PM -, Perl6 RFC Librarian wrote: > > Objects : Core support for method delegation > > I like it! One gripe (of course)... > > > > The proposed delegation mechanism would wo

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-05 Thread Piers Cawley
Perl6 RFC Librarian <[EMAIL PROTECTED]> writes: > This and other RFCs are available on the web at > http://dev.perl.org/rfc/ > > =head1 TITLE > > Objects : Core support for method delegation I *want* this. Delegation is cool. Delegation that gets set up at compile ti

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-04 Thread Uri Guttman
>>>>> "DC" == Damian Conway <[EMAIL PROTECTED]> writes: PRL> use Class::Delegation >> >> shouldn't that be use delegation? i think you have a cut and paste >> error. DC> You're correct. Many thanks. DC> (That

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-04 Thread Michael G Schwern
On Mon, Sep 04, 2000 at 09:53:39PM -, Perl6 RFC Librarian wrote: > Objects : Core support for method delegation I like it! One gripe (of course)... > The proposed delegation mechanism would work via a pragma: > > use delegation > attr1 => [qw( metho

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-04 Thread Damian Conway
> PRL> One powerful application of delegation is as a replacement for > PRL> inheritance where the internals of a prospective base class are > PRL> inaccessible or inconvenient, or the base class was not designed > PRL> to be inherited and yet it must b

Re: RFC 193 (v1) Objects : Core support for method delegation

2000-09-04 Thread Uri Guttman
>>>>> "PRL" == Perl6 RFC Librarian <[EMAIL PROTECTED]> writes: PRL> One powerful application of delegation is as a replacement for PRL> inheritance where the internals of a prospective base class are PRL> inaccessible or inconvenient, or the

RFC 193 (v1) Objects : Core support for method delegation

2000-09-04 Thread Perl6 RFC Librarian
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Objects : Core support for method delegation =head1 VERSION Maintainer: Damian Conway <[EMAIL PROTECTED]> Date: 4 September 2000 Mailing List: [EMAIL PROTECTED] Version: 1 Number: 193