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

extern enum ? #899

Closed
horasal opened this issue Jul 10, 2015 · 1 comment
Closed

extern enum ? #899

horasal opened this issue Jul 10, 2015 · 1 comment
Milestone

Comments

@horasal
Copy link
Contributor

horasal commented Jul 10, 2015

In the document of official site ( http://ooc-lang.org/docs/lang/enums/ )
It says:

Or, each element can be aliased individually:

ShutdownParam: extern enum {
  extern(SHUT_RD) read
  extern(SHUT_WR) write
  extern(SHUT_RDWR) readWrite
}

However, when I try to compile it, rock gives:

INSERT$ rock test.ooc

 test.ooc:2:5 error Expected enum element!

    extern(SHUT_RD) read 
    ~                    

[FAIL]
@fasterthanlime
Copy link
Collaborator

Alright so extern enums (as in, using the extern keyword with an enum) is broken, I don't think it should even be allowed right now.

As for parameters that are in fact aliases, the doc is wrong, it should read:

ShutdownParam: enum {
    read: extern(SHUT_RD)
    write: extern(SHUT_WR)
    readWrite: extern(SHUT_RDWR)
}

This, plus:

SHUT_RD   : unmangled Int = 1
SHUT_WR   : unmangled Int = 2
SHUT_RDWR : unmangled Int = 3

Does compile.

fasterthanlime added a commit to ooc-lang/nagaqueen that referenced this issue Jul 10, 2015
fasterthanlime added a commit to ooc-lang/ooc-lang.org that referenced this issue Jul 10, 2015
@fasterthanlime fasterthanlime modified the milestone: 0.9.10 Jul 10, 2015
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

2 participants