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

using previously defined names as values in enumerations #147

Open
grondilu opened this issue Aug 30, 2016 · 0 comments
Open

using previously defined names as values in enumerations #147

grondilu opened this issue Aug 30, 2016 · 0 comments

Comments

@grondilu
Copy link
Contributor

grondilu commented Aug 30, 2016

The C programming language allows enumeration constants like this one:

enum { foo, bar = foo };

In Perl 6, that would correspond to:

enum ("foo", bar => foo);

Currently, such code dies like this:

===SORRY!=== Error while compiling -e
Undeclared routine:
    foo used at line 1

I did not see it tested anywhere in S12-enum/, which means either that I failed to find it, that Perl 6 is not meant to behave as C in that regard, or that it was involuntary omitted.

The second case would be LTA imho. I stumbled upon such kind of enum while looking at a header file for the Vulkan 3D graphics API. I don't look at C header files very often so the fact that I've seen this construction suggests that they are not very rare. I believe Perl 6's enumeration constants should behave similarly as their C counterparts, since that would help the translation of C header files for NativeCall bindings.

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