Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: Method/attribute chaining: msg#00112

lang.perl.perl6.compiler

Subject: Re: Method/attribute chaining

Hi,

I have seen similar weirdness and added a couple of tests over the
weekend, whilst simultaneously forgetting to mention it on IRC:

class Foo {
method noargs () { 42 }
method callsmethod2 { .noargs(); }
}

$val = $foo.callsmethod2()

dies. (t/oo/method/instance.t)

It appears to be something to do with whether the methods are declared
with brackets (method callsmethod2 versus method callsmethod2()).

Maybe this is related.

Cheers

Ade

Alex Gutteridge wrote:

> Hi,
>
> Just playing around with pugs 6.2.5 OO and couldn't work this out:
>
> class Bowl {
> has $.fish is rw;
> has $.water is rw;
> }
> class Fish {
> has $.bowl is rw;
> has $.eyes is rw;
> }
>
> my $bowl = Bowl.new;
> my $blinky = Fish.new;
>
> $bowl.water = 'Murky';
> $blinky.eyes = 3;
>
> $bowl.fish = $blinky;
> $blinky.bowl = $bowl;
>
> $bowl.water.say;
> $blinky.eyes.say;
>
> my $blinkys_bowl = $blinky.bowl;
> $blinkys_bowl.water.say;
>
> my $fishy = $bowl.fish;
> $fishy.eyes.say;
>
> $bowl.fish.eyes.say;
> $blinky.bowl.water.say;
>
> The output I get:
>
> Murky
> 3
> Murky
> 3
> *** No compatible subroutine found: "&eyes"
> at Desktop/testOO.pl line 27, column 1-20
>
> Am I missing something in the syntax when I try to chain the
> attribute methods? Or is this not implemented in pugs yet?
>
> Thanks for any help.
>
> Alex Gutteridge
>
> EBI
> Wellcome Trust Genome Campus
> Hinxton
> Cambs CB10 1SD
> UK
>
> Tel: 01223 492546
> Email: alexg@xxxxxxxxx
>
>




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    gcc.libstdc++.c...    solaris.opensol...    information-ret...    misc.misterhous...    web.catalyst.ge...    apache.webservi...    redhat.release....    hardware.lirc/2...    kernel.autofs/2...    technology.sust...    linux.vdr/2003-...    editors.lyx.gen...    org.user-groups...    netbsd.devel.pk...    xdg.devel/2004-...    version-control...    jakarta.slide.d...    debian.packages...    creativecommons...    ports.ppc.embed...    bug-tracking.bu...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe