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

Error when defining a class method called 'list' #590

Closed
p6rt opened this issue Jan 7, 2009 · 5 comments
Closed

Error when defining a class method called 'list' #590

p6rt opened this issue Jan 7, 2009 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jan 7, 2009

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

Searchable as RT62046$

@p6rt
Copy link
Author

p6rt commented Jan 7, 2009

From @cspencer

When defining a class as follows​:

  class Foo {
  method list {
  say "bar"
  }
  };

calling the 'list' method as below​:

  my $f = Foo.new;
  $f.list

will produce the following error in Rakudo​:

  too few arguments passed (0) - 1 params expected
  current instr.​: 'parrot;Foo;list' pc 187 (EVAL_13​:91)
  ...

Changing the method's name from 'list' to something else does not produce
the same error.

@p6rt
Copy link
Author

p6rt commented Jan 11, 2009

From @pmichaud

On Wed Jan 07 09​:16​:32 2009, cspencer wrote​:

class Foo {
method list {
say "bar"
}
};

my $f = Foo.new;
$f.list

will produce the following error in Rakudo​:

too few arguments passed (0) - 1 params expected
current instr.​: 'parrot;Foo;list' pc 187 (EVAL_13​:91)
...

Now fixed as of r35418​:

  $ cat x
  class Foo {
  method list { say "bar"; }
  }

  my $f = Foo.new;
  $f.list;

  $ ./parrot perl6.pbc x
  bar
  $

Note however, that the 'list' method is the one that gets called by
various operators to obtain the list representation of an Object, so
overriding it in this fashion might produce some bizarre results.

Assigning to moritz for spectest update.

Thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Jan 11, 2009

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

@p6rt
Copy link
Author

p6rt commented Jan 11, 2009

From @moritz

On Sun Jan 11 07​:26​:53 2009, pmichaud wrote​:

On Wed Jan 07 09​:16​:32 2009, cspencer wrote​:

class Foo {
method list {
say "bar"
}
};

my $f = Foo.new;
$f.list

will produce the following error in Rakudo​:

too few arguments passed (0) - 1 params expected
current instr.​: 'parrot;Foo;list' pc 187 (EVAL_13​:91)
...

Now fixed as of r35418​:

$ cat x
class Foo {
method list { say "bar"; }
}

my $f = Foo.new;
$f.list;

$ ./parrot perl6.pbc x
bar
$

Note however, that the 'list' method is the one that gets called by
various operators to obtain the list representation of an Object, so
overriding it in this fashion might produce some bizarre results.

Assigning to moritz for spectest update.

Added a test to t/spec/S12-methods/instance.t

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Jan 11, 2009

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

@p6rt p6rt closed this as completed Jan 11, 2009
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