digitalmars.D.learn - Why enum of structs are not initialised?
- mimocrocodil (10/10) Aug 11 2011 code:
- bearophile (5/6) Aug 11 2011 I think D enums are mostly meant for enumerations, of things like ints, ...
- Jonathan M Davis (9/14) Aug 11 2011 That's incorrect. TDPL specifically talks about using structs as the typ...
- mimocrocodil (3/6) Aug 11 2011 Yes
code: private struct request_variant { package: immutable string sql_query; } enum test : request_variant { current_time = request_variant( "SELECT now()" ), //users = { sql_query: "SELECT 'users list'::text" } } causes syntax error if I am uncommit second string in enum
Aug 11 2011
mimocrocodil:causes syntax error if I am uncommit second string in enumI think D enums are mostly meant for enumerations, of things like ints, ushorts, chars, etc. (But enhancement requests are possible). Also is that "package:" actually working? Bye, bearophile
Aug 11 2011
On Thursday, August 11, 2011 13:18 bearophile wrote:mimocrocodil:That's incorrect. TDPL specifically talks about using structs as the type of an enum. However, there are bugs with it which make it so that it doesn't really work at the moment. Among them are: http://d.puremagic.com/issues/show_bug.cgi?id=4423 http://d.puremagic.com/issues/show_bug.cgi?id=5460 If you see any bugs with regards to structs not working as enum values, please report them if you can't find them in bugzilla. - Jonathan M Daviscauses syntax error if I am uncommit second string in enumI think D enums are mostly meant for enumerations, of things like ints, ushorts, chars, etc. (But enhancement requests are possible).
Aug 11 2011
bearophile:causes syntax error if I am uncommit second string in enumI think D enums are mostly meant for enumerations, of things like ints, ushorts, chars, etc. (But enhancement requests are possible).I want to use this enum in 'final switch' statement.Also is that "package:" actually working?Yes
Aug 11 2011