extern enum ? #899

Closed
zhaihj opened this Issue Jul 10, 2015 · 1 comment

Projects

None yet

2 participants

@zhaihj
Contributor
zhaihj 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
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 fasterthanlime added a commit to ooc-lang/ooc-lang.org that referenced this issue Jul 10, 2015
@fasterthanlime fasterthanlime Fix doc, re ooc-lang/rock#899 704ac30
@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