Re: Do a class invariants affect -release builds?

2015-12-06 Thread Andrew LaChance via Digitalmars-d-learn
On Saturday, 5 December 2015 at 23:27:31 UTC, Steven Schveighoffer wrote: On 12/5/15 6:06 PM, Andrew LaChance wrote: I was reading a blog post here: http://3d.benjamin-thaut.de/?p=20 which mentions: "Calls to the druntime invariant handler are emitted in release build also and there is no

Do a class invariants affect -release builds?

2015-12-05 Thread Andrew LaChance via Digitalmars-d-learn
I was reading a blog post here: http://3d.benjamin-thaut.de/?p=20 which mentions: "Calls to the druntime invariant handler are emitted in release build also and there is no way to turn them off. Even if the class does not have any invariants the invariant handler will always be called, walk

Re: Classes as enums in D?

2015-11-30 Thread Andrew LaChance via Digitalmars-d-learn
On Monday, 30 November 2015 at 08:08:20 UTC, Meta wrote: This doesn't quite work in D; you'd have to make each WhiteKey const (which is probably not a bad idea anyway if you're using it like an enum). However, it's better to just do this with plain old value-type structs. It's exactly the same

Re: Classes as enums in D?

2015-11-30 Thread Andrew LaChance via Digitalmars-d-learn
On Monday, 30 November 2015 at 07:54:49 UTC, Rikki Cattermole wrote: enums don't have to be integral, but for performance reasons it is for the best. enum Foo : string { A = "a", B = "b", C = "d", ERROR = "What are you talking about?" } void main() { import std.stdio :

Classes as enums in D?

2015-11-29 Thread Andrew LaChance via Digitalmars-d-learn
Hello, D has intrigued me for a while, and I thought I would finally read up on it! I've been reading "Programming in D" by Ali Çehreli and I've been thinking about how I can use the language in a side project I'm working on, porting it from java to D. One of the uncommonly-used features of