[parrot/parrot] 49c3a7: [test] sub dispatch with builtin namespace
GitHub
noreply at github.com
Wed Feb 17 18:25:33 UTC 2016
Branch: refs/heads/smoke-me/builtin+sub-gh304
Home: https://github.com/parrot/parrot
Commit: 49c3a7aac81fe423edc3260e2ee66d6df1502e77
https://github.com/parrot/parrot/commit/49c3a7aac81fe423edc3260e2ee66d6df1502e77
Author: Reini Urban <rurban at cpanel.net>
Date: 2016-02-17 (Wed, 17 Feb 2016)
Changed paths:
M t/pmc/namespace-subs.t
Log Message:
-----------
[test] sub dispatch with builtin namespace
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
Commit: 12124f26e425a639a4d3503e2fe6d986ded795e8
https://github.com/parrot/parrot/commit/12124f26e425a639a4d3503e2fe6d986ded795e8
Author: Reini Urban <rurban at cpanel.net>
Date: 2016-02-17 (Wed, 17 Feb 2016)
Changed paths:
M ChangeLog
M config/gen/makefiles/root.in
M include/parrot/sub.h
M src/oo.c
M src/pmc/object.pmc
Log Message:
-----------
[core] fix sub dispatch with builtin namespace
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
Compare: https://github.com/parrot/parrot/compare/37cb14f2c3d4...12124f26e425
More information about the parrot-commits
mailing list