Re: nested enum
And if you need more levels: struct MyEnum { static struct AnotherEnum { enum X { Y = 10, Z = 20 } } } void main() { import std.stdio; int y = MyEnum.AnotherEnum.X.Y; writeln(y); } Dne 25.8.2016 v 03:37 Mike Parker via Digitalmars-d-learn napsal(a): On Wednesday, 24 August 2016 at 23:04:25 UTC, Illuminati wrote: How can I create nested enum like structures? instead of Enum.X_Y I would like to access like Enum.X.Y Yet I want it to behave exactly as an enum. I just want to not use _ as .'s are better as they express more clearly what I want. struct MyEnum { enum X { Y = 10, Z = 20 } } void main() { import std.stdio; int y = MyEnum.X.Y; writeln(y); }
Re: nested enum
On Wednesday, 24 August 2016 at 23:04:25 UTC, Illuminati wrote: How can I create nested enum like structures? instead of Enum.X_Y I would like to access like Enum.X.Y Yet I want it to behave exactly as an enum. I just want to not use _ as .'s are better as they express more clearly what I want. struct MyEnum { enum X { Y = 10, Z = 20 } } void main() { import std.stdio; int y = MyEnum.X.Y; writeln(y); }
nested enum
How can I create nested enum like structures? instead of Enum.X_Y I would like to access like Enum.X.Y Yet I want it to behave exactly as an enum. I just want to not use _ as .'s are better as they express more clearly what I want.
Re: pow exponent type issue
On Wednesday, 24 August 2016 at 19:41:35 UTC, ag0aep6g wrote: -y1 is -1. But -y2 is uint.max, i.e. a pretty large positive number. The 'u' in "uint" stands for "unsigned". That is, it doesn't know negative numbers. Dont' use uint when you need negative numbers. Ahh, doh.
Re: pow exponent type issue
On Wednesday, 24 August 2016 at 19:16:56 UTC, jmh530 wrote: I'm a little confused on why pow behaves so differently when switching from an int to a uint for the exponent. import std.math : pow; import std.stdio : writeln; void main() { float x = 2; int y1 = 1; uint y2 = 1; writeln(pow(x, -y1)); //prints 0.5 writeln(pow(x, -y2)); //prints inf } -y1 is -1. But -y2 is uint.max, i.e. a pretty large positive number. The 'u' in "uint" stands for "unsigned". That is, it doesn't know negative numbers. Dont' use uint when you need negative numbers.
Re: Hosting a vibe.d website
On Wednesday, 24 August 2016 at 19:19:33 UTC, Karabuta wrote: Hello community, I usually host PHP websites for clients using shared hosting services but I'm not familiar with hosting compiled programming language websites. What processes are involved hosting a vibe.d website developed locally on a web server (shared hosting plan). And what hosting services/packages are available for that? Heroku is quite popular because it's free in the basic version and comes with zero maintenance or need of administrator skills: http://tour.dlang.io/tour/en/vibed/deploy-on-heroku However you can deploy a vibe.d application on literally any machine and even a VPS server should work quite fine. If you are low on budget, you can usually spot great deals over at the Low End Box Blog [1] (I am not affiliated with them in any way) [1] http://lowendbox.com/
pow exponent type issue
I'm a little confused on why pow behaves so differently when switching from an int to a uint for the exponent. import std.math : pow; import std.stdio : writeln; void main() { float x = 2; int y1 = 1; uint y2 = 1; writeln(pow(x, -y1)); //prints 0.5 writeln(pow(x, -y2)); //prints inf }
Hosting a vibe.d website
Hello community, I usually host PHP websites for clients using shared hosting services but I'm not familiar with hosting compiled programming language websites. What processes are involved hosting a vibe.d website developed locally on a web server (shared hosting plan). And what hosting services/packages are available for that?
Re: Metaprogramming, generate argument list.
On Tuesday, 23 August 2016 at 21:14:01 UTC, ciechowoj wrote: This is a bit strange, as the local variables aren't known either and they seem to work. I do not want to get the address, rather an alias to `` expression. D doesn't accept aliases to expressions, only symbols and literals. Spec: https://dlang.org/spec/template.html#TemplateAliasParameter Alias parameters enable templates to be parameterized with almost any kind of D symbol, including user-defined type names, global names, local names, module names, template names, and template instance names. Literals can also be used as arguments to alias parameters.