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

WHAT stringifies to just the last token of a :: separated class name #396

Closed
p6rt opened this issue Nov 8, 2008 · 5 comments
Closed

WHAT stringifies to just the last token of a :: separated class name #396

p6rt opened this issue Nov 8, 2008 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Nov 8, 2008

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

Searchable as RT60400$

@p6rt
Copy link
Author

p6rt commented Nov 8, 2008

From @chrisdolan

Test case #​1​:
  ./perl6 -e'class Foo​::Bar {}; say Foo​::Bar.new.WHAT'
Got​:
  Bar
Expected​:
  Foo​::Bar

Test case #​2 (which is just a special case of test case #​1)​:
  ./perl6 -e'class Foo​::Bar {}; say Foo​::Bar.new'
Got​:
  Bar<0x4099e80>
Expected​:
  Foo​::Bar<0x4099e80>

./perl6 -v
This is Rakudo Perl 6, revision 32442 built on parrot 0.8.0-devel
for darwin-thread-multi-2level.

@p6rt
Copy link
Author

p6rt commented Nov 8, 2008

From @chrisdolan

A PIR implementation for the expected stringification is​:

.sub 'wibble'
  .param pmc x
  $P0 = x.'HOW'()
  $P1 = getattribute $P0, 'longname'
  $S0 = $P1
  .return ($S0)
.end

But I'm not sure what to call it or where to put it... Maybe
P6protoobject's vtable(get_string) should return 'longname' instead of
'shortname'?

@p6rt
Copy link
Author

p6rt commented Nov 8, 2008

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

@p6rt
Copy link
Author

p6rt commented Nov 8, 2008

From @pmichaud

On Fri, Nov 07, 2008 at 11​:21​:32PM -0800, Chris Dolan wrote​:

# New Ticket Created by Chris Dolan
# Please include the string​: [perl #​60400]
# in the subject line of all future correspondence about this issue.
# <URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=60400 >

Test case #​1​:
./perl6 -e'class Foo​::Bar {}; say Foo​::Bar.new.WHAT'
Got​:
Bar
Expected​:
Foo​::Bar

Rakudo has the correct behavior here -- .WHAT stringifies to
the short name. From Synopsis 12, "Introspection"​:

  Metamethods for objects are named with interrogative pronouns in uppercase​:

  WHAT the prototype object of the type, stringifies to short name
  WHICH the object's identity value
  WHO the package supporting the object, stringifies to long name
  ...

Test case #​2 (which is just a special case of test case #​1)​:
./perl6 -e'class Foo​::Bar {}; say Foo​::Bar.new'
Got​:
Bar<0x4099e80>
Expected​:
Foo​::Bar<0x4099e80>

There might be an argument that we should use .WHO for default
stringification -- but (1) we don't have an implementation of .WHO
yet, and (2) much of this is speculative anyway since there aren't
any specifications or tests for this behavior. Thus I'm inclined
to leave things as they are for now.

Thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Nov 8, 2008

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

@p6rt p6rt closed this as completed Nov 8, 2008
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant