digitalmars.D.learn - what is missing here?
- Jonathan Villa (40/40) May 03 2016 public final class accounts
- ag0aep6g (8/39) May 03 2016 Types are not values. You cannot return a type from a function. Use
- Jonathan Villa (4/12) May 03 2016 Thank you, I thought alias was just allowed to be declared
public final class accounts { public: static table_user user; } public final class table_user { private: static uint32 dummy1; static string dummy2; static DateTime dummy3; static ubyte dummy4; public: static property auto user_id_t() { return typeof(dummy1); } static property auto name_t() { return typeof(dummy2); } static property auto alias_t() { return typeof(dummy2);} static property auto pers_email_t() { return typeof(dummy2); } static property auto corp_email_t() { return typeof(dummy2); } static property auto password_t() { return typeof(dummy2); } static property auto last_login_t() { return typeof(dummy3); } static property auto active_t() { return typeof(dummy4); } static property auto id_lang_t() { return typeof(dummy4); } static property auto function_t() { return typeof(dummy4); } static property auto register_date_t() { return typeof(dummy3); } } for every property it throws me an error at compile time: type ($) has no value. I'm trying to do a wrap of a database so when getting a resultset using mysql-native I can do result.front()[0].get!(accounts.user.user_it_t); si it's more readable.
May 03 2016
On 03.05.2016 18:03, Jonathan Villa wrote:public final class accounts { public: static table_user user; } public final class table_user { private: static uint32 dummy1; static string dummy2; static DateTime dummy3; static ubyte dummy4; public: static property auto user_id_t() { return typeof(dummy1); } static property auto name_t() { return typeof(dummy2); } static property auto alias_t() { return typeof(dummy2);} static property auto pers_email_t() { return typeof(dummy2); } static property auto corp_email_t() { return typeof(dummy2); } static property auto password_t() { return typeof(dummy2); } static property auto last_login_t() { return typeof(dummy3); } static property auto active_t() { return typeof(dummy4); } static property auto id_lang_t() { return typeof(dummy4); } static property auto function_t() { return typeof(dummy4); } static property auto register_date_t() { return typeof(dummy3); } } for every property it throws me an error at compile time: type ($) has no value. I'm trying to do a wrap of a database so when getting a resultset using mysql-native I can do result.front()[0].get!(accounts.user.user_it_t); si it's more readable.Types are not values. You cannot return a type from a function. Use aliases instead: ---- alias user_id_t = typeof(dummy1); alias name_t = typeof(dummy2); /* ... etc ... */ ----
May 03 2016
On Tuesday, 3 May 2016 at 16:13:07 UTC, ag0aep6g wrote:On 03.05.2016 18:03, Jonathan Villa wrote: Types are not values. You cannot return a type from a function. Use aliases instead: ---- alias user_id_t = typeof(dummy1); alias name_t = typeof(dummy2); /* ... etc ... */ ----Thank you, I thought alias was just allowed to be declared outside, but declaring them inside as public it now behaves like I want.
May 03 2016