Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispatch of static method call calls method in child class #961

Closed
p6rt opened this issue Apr 30, 2009 · 5 comments
Closed

Dispatch of static method call calls method in child class #961

p6rt opened this issue Apr 30, 2009 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Apr 30, 2009

Migrated from rt.perl.org#65272 (status was 'resolved')

Searchable as RT65272$

@p6rt
Copy link
Author

p6rt commented Apr 30, 2009

From arnsholt@gmail.com

The following script gives the ouput "A\nB", but the correct output
should probably be "A\nA".

class A {
  method x {
  say "A";
  }
}

class B is A {
  method x() {
  say "B";
  }
}

my B $b .= new;
A.HOW.dispatch($b, "x");
A.HOW.dispatch(B, "x");

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

From @coke

On Thu Apr 30 06​:15​:23 2009, arnsholt wrote​:

The following script gives the ouput "A\nB", but the correct output
should probably be "A\nA".

class A {
method x {
say "A";
}
}

class B is A {
method x() {
say "B";
}
}

my B $b .= new;
A.HOW.dispatch($b, "x");
A.HOW.dispatch(B, "x");

Current status​:

$ ./perl6 foo.p6
Method 'dispatch' not found for invocant of class ''
  in main program body at line 14​:foo.p6

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 14, 2011

From @jnthn

On Tue Jul 27 18​:39​:17 2010, coke wrote​:

On Thu Apr 30 06​:15​:23 2009, arnsholt wrote​:

The following script gives the ouput "A\nB", but the correct output
should probably be "A\nA".

class A {
method x {
say "A";
}
}

class B is A {
method x() {
say "B";
}
}

my B $b .= new;
A.HOW.dispatch($b, "x");
A.HOW.dispatch(B, "x");

Current status​:

$ ./perl6 foo.p6
Method 'dispatch' not found for invocant of class ''
in main program body at line 14​:foo.p6

Well, .^dispatch is decidedly not spec. But this works​:

class A {
  method x {
  say "A";
  }
}

class B is A {
  method x() {
  say "B";
  }
}

my B $b .= new;
$b.A​::x();
$b.B​::x();
$b.x();

Output​:

A
B
B

There are tests for this, so resolving ticket.

/jnthn

@p6rt
Copy link
Author

p6rt commented Sep 14, 2011

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Sep 14, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant