Jari-Matti Mäkelä wrote:
Jeremie Pelletier wrote:

Nick Sabalausky wrote:
union A {
int foo;
float bar;
}

Yet it's the only way I know of to do bitwise logic on floating points
in D to extract the exponent, sign and mantissa for example.

You could add built-in methods for those operations to the float type:

float bar;

boolean s = bar.sign;
...

That would be so inefficient in some cases, you don't always want to shift the data like bar.sign implies.

Union is very flexible, but unfortunately it's also one of the features that can break the type safety in D.

That's the best thing about systems languages: to have a core set of rules, and to be able to purposely break them. Even better, you still pass go and still get $200.

I don't want a language that takes me by the hand for a walk in the park. I want a language that keeps me on my toes and punch me in the face every now and then :)

Reply via email to