Ticket #1296 (closed bug: wontfix)

Opened 5 years ago

Last modified 5 years ago

:vtable is ignored when :anon

Reported by: Bram Geron <bgeron@…> Owned by:
Priority: normal Milestone:
Component: none Version:
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

:vtable subs are not stored in the vtable slot of a namespace when :anon is set. This is because :anon blocks the sub from reaching the namespace:

src/global.c: (Parrot_store_sub_in_namespace) 613 else if (!(PObj_get_FLAGS(sub) & SUB_FLAG_PF_ANON)) { ... ... 617 Parrot_store_global_n(interp, ns, name, sub);

Parrot_store_global_n calls namespace->set_pmc_keyed_str, which also checks if subs are :anon, so the check in Parrot_store_sub_in_namespace seems to be unnecessary. If we remove it, :vtable :anon works.

This patch removes the check in Parrot_store_sub_in_namespace, and there's a test too. Created t/compilers/imcc/syn/sub.t for that.

src/global.c | 5 +++-- t/compilers/imcc/syn/sub.t | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-)

-- Bram Geron | GPG 0xE7B9E65E

Attachments

vtableanon.patch Download (1.4 KB) - added by coke 5 years ago.
vtableanon.patch

Change History

Changed 5 years ago by coke

vtableanon.patch

  Changed 5 years ago by coke

follow-up: ↓ 3   Changed 5 years ago by coke

Comment on original ticket:

RT #53302 extends the meanings of various sub flags such that :vtable
now always implies :anon. As such, I think we can either apply this
patch or reject it, given that we expect a refactor of :vtable and
:method handling to occur at some point in the future.

Personally I'd suggest to reject it for now. Once possible workaround
might be to do

.sub "" :anon :vtable('get_integer')

Pm

in reply to: ↑ 2   Changed 5 years ago by coke

  • status changed from new to closed
  • resolution set to wontfix

As I was transferring this from RT, the original was rejected. See TT #389 for any followup.

Note: See TracTickets for help on using tickets.