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

Conflicting sub names and enum values #744

Closed
p6rt opened this issue Mar 4, 2009 · 5 comments
Closed

Conflicting sub names and enum values #744

p6rt opened this issue Mar 4, 2009 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Mar 4, 2009

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

Searchable as RT63650$

@p6rt
Copy link
Author

p6rt commented Mar 4, 2009

From @moritz

Pugs r25693 contains clarification on what should happen when a short
name of an enum value is the same as a sub name.

1438 Like type names, enum names are parsed as standalone tokens
1439 representing scalar values, and don't look for any arguments.
1440 Unlike type names which are undefined protoobjects, enums are defined
1441 constant values. Also unlike types, they do not respond to C<.()>.
1442 They may not be post-declared.
1443
1444 our enum Maybe <OK FAIL>;
1445 sub OK {...}
1446 $x = OK; # certainly the enum value
1447 $x = OK() # certainly the function

I've added a test for that to t/spec/S12-enums/basic.t

The first part (meaning the enum value without parens) works in Rakudo,
the second dies with

too few arguments passed (0) - 1 params expected
current instr.​: '_block325' pc 1991 (EVAL_25​:554)
called from Sub '_block157' pc 2995 (EVAL_25​:898)
...

at run time.

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

From @coke

On Wed Mar 04 14​:48​:16 2009, moritz wrote​:

Pugs r25693 contains clarification on what should happen when a short
name of an enum value is the same as a sub name.

1438 Like type names, enum names are parsed as standalone tokens
1439 representing scalar values, and don't look for any arguments.
1440 Unlike type names which are undefined protoobjects, enums are defined
1441 constant values. Also unlike types, they do not respond to C<.()>.
1442 They may not be post-declared.
1443
1444 our enum Maybe <OK FAIL>;
1445 sub OK {...}
1446 $x = OK; # certainly the enum value
1447 $x = OK() # certainly the function

I've added a test for that to t/spec/S12-enums/basic.t

The first part (meaning the enum value without parens) works in Rakudo,
the second dies with

too few arguments passed (0) - 1 params expected
current instr.​: '_block325' pc 1991 (EVAL_25​:554)
called from Sub '_block157' pc 2995 (EVAL_25​:898)
...

at run time.

Cheers,
Moritz

Moritz - I cannot find this test in this file, and no RT reference for this in t/spec/S12-enums
- can you double check & add the RT to the spec test file?

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

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

@p6rt
Copy link
Author

p6rt commented Sep 24, 2011

From @moritz

I didn't find the tests either, so I've recreated them in
S12-enums/misc.t. They also pass, so ticket closed.

@p6rt
Copy link
Author

p6rt commented Sep 24, 2011

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

@p6rt p6rt closed this as completed Sep 24, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant