Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

--> and returns have different behavior #5541

Open p6rt opened 8 years ago

p6rt commented 8 years ago

Migrated from rt.perl.org#128861 (status was 'new')

Searchable as RT128861$

p6rt commented 8 years ago

From @ajs

These two commands (circa rakudo-moar 146e18) have different output​:

$ perl6 -e 'class Foo { method bar(--> Str​:D) {} }; say Foo.^methods.map​: {"{.name}={.WHAT.perl}, returns {.returns.perl}"}' (bar=Method, returns Str​:D) $ perl6 -e 'class Foo { method bar() returns Str​:D {} }; say Foo.^methods.map​: {"{.name}={.WHAT.perl}, returns {.returns.perl}"}' (bar=Method+{Callable[Str​:D]}, returns Str​:D)

But it seems as if they should have the same output.

This also came up here​:

https://github.com/rakudo/rakudo/pull/798

Relevant IRC log​:

[11​:12] \ m​: my method bar() returns Str {}; say &bar.^name; [11​:12] \<+camelia> rakudo-moar 146e18​: OUTPUT«Method+{Callable[Str]}␤» [11​:12] \ m​: my method bar(--> Str) {}; say &bar.^name; [11​:12] \<+camelia> rakudo-moar 146e18​: OUTPUT«Method␤» [11​:13] == telex [teletype@​freeshell.de] has quit [Ping timeout​: 258 seconds] [11​:13] \ Uh... am I misunderstanding what "returns" is for or does that not make any sense? [11​:13] \ harmil​: Seems weird to me too [11​:13] \ A leaking implementation detail maybe? [11​:14] \ methinks [11​:14] \ there are odd differences between (--> RetType) and returns RetType that shouldnt exist

-- Aaron Sherman, M.​: P​: 617-440-4332 Google Talk, Email and Google Plus​: ajs@​ajs.com Toolsmith, developer, gamer and life-long student.