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
Subs in "built-in PMC" namespaces are treated as PMC methods #304
Comments
rurban
pushed a commit
that referenced
this issue
Feb 17, 2016
Subs in "built-in PMC" namespaces are treated as PMC methods even without the :method attribute. P1=new Integer P1.foo() namespace Integer sub foo Should error with Method 'foo' not found for invocant of class 'Integer' as it happens with subs of new namespaces. This allows overriding of builtin methods, but it also makes it impossible to write "class methods" that translate behaviors, since the presence or absence of the :method attribute on the sub is ignored. See GH #304, prev. TT #1108
rurban
pushed a commit
that referenced
this issue
Feb 17, 2016
Filter out pure-subs without a method attribute in Parrot_find_method_direct(). This harmonizes behavior with user-defined namespaces. P1=new Integer P1.foo() namespace Integer sub foo Does now error with Method foo not found for invocant of class Integer as it happens with subs of new namespaces. You need to add a :method attribute. This allows to write user class methods that translate behaviors. Fixes GH #304, prev. TT #1108
rurban
pushed a commit
that referenced
this issue
Feb 17, 2016
Subs in "built-in PMC" namespaces are treated as PMC methods even without the :method attribute. P1=new Integer P1.foo() namespace Integer sub foo Should error with Method 'foo' not found for invocant of class 'Integer' as it happens with subs of new namespaces. This allows overriding of builtin methods, but it also makes it impossible to write "class methods" that translate behaviors, since the presence or absence of the :method attribute on the sub is ignored. See GH #304, prev. TT #1108
rurban
pushed a commit
that referenced
this issue
Feb 17, 2016
Filter out pure-subs without a method attribute in Parrot_find_method_direct(). This harmonizes behavior with user-defined namespaces. P1=new Integer P1.foo() namespace Integer sub foo Does now error with Method foo not found for invocant of class Integer as it happens with subs of new namespaces. You need to add a :method attribute. This allows to write user class methods that translate behaviors. Fixes GH #304, prev. TT #1108
rurban
pushed a commit
that referenced
this issue
Feb 17, 2016
Subs in "built-in PMC" namespaces are treated as PMC methods even without the :method attribute. P1=new Integer P1.foo() namespace Integer sub foo Should error with Method 'foo' not found for invocant of class 'Integer' as it happens with subs of new namespaces. This allows overriding of builtin methods, but it also makes it impossible to write "class methods" that translate behaviors, since the presence or absence of the :method attribute on the sub is ignored. See GH #304, prev. TT #1108
rurban
pushed a commit
that referenced
this issue
Feb 17, 2016
Filter out pure-subs without a method attribute in Parrot_find_method_direct(). This harmonizes behavior with user-defined namespaces. P1=new Integer P1.foo() namespace Integer sub foo Does now error with Method foo not found for invocant of class Integer as it happens with subs of new namespaces. You need to add a :method attribute. This allows to write user class methods that translate behaviors. Fixes GH #304, prev. TT #1108
will be in 8.2.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A sub that is declared in a namespace that matches the name of a builtin PMC is automatically dispatched as a method:
While this does make it possible to override builtin methods,
it also makes it impossible to write "class methods" that translate behaviors, since the presence or absence of the
:method
attribute on the sub is ignored.This behavior does not happen with non-builtin classes:
Originally http://trac.parrot.org/parrot/ticket/1108
The text was updated successfully, but these errors were encountered: