Enums toString

12 views
Skip to first unread message

david.h...@gmail.com

unread,
Apr 7, 2015, 10:19:17 AM4/7/15
to ooc-...@googlegroups.com
If I have an enum

Foo: enum {
Bar
Baz
}

and a variable

foo := Foo Bar

is there a way to print "Bar" or "Foo Bar" by calling some function foo toString(), without manually implementing a switch statement in Foo toString() that returns a hard-coded String for each possible value of Foo?

Amos Wenger

unread,
Apr 7, 2015, 10:22:53 AM4/7/15
to David Hesselbom, ooc-...@googlegroups.com
not as of yet, but that was a feature I really wanted to add to enums.

cheers,
- A


--
You received this message because you are subscribed to the Google Groups "ooc-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ooc-lang+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Hesselbom

unread,
Apr 8, 2015, 3:39:23 AM4/8/15
to Amos Wenger, ooc-...@googlegroups.com
OK. Is that what you meant by the "name" field in https://github.com/fasterthanlime/rock/issues/631, or is that something else?

Amos Wenger

unread,
Apr 8, 2015, 4:59:36 PM4/8/15
to David Hesselbom, ooc-...@googlegroups.com

That is indeed what I meant.

Reply all
Reply to author
Forward
0 new messages