On Wed, Mar 07, 2018 at 03:52:19PM +0000, Nick Treleaven via Digitalmars-d wrote: > On Wednesday, 28 February 2018 at 20:01:34 UTC, H. S. Teoh wrote: > > As Andrei wrote in TDPL, (and I paraphrase,) it sucks when built-in > > types have magical abilities inaccessible to user code. This is a > > common defect in many programming languages... the "magical" > > behaviour is wonderful when it works. But if you need something that > > said "magic" doesn't cover, you're left up the creek without a > > paddle. In D, however, you're given the tools to build your own > > equivalents of language built-ins. > > Not true for implicit construction of a user-defined type. So you > can't have a `struct Pointer` wrap a pointer fully because you can't > pass null to a function taking a Pointer. You can't do the same for > Algebraic element types, they're not Algebraic. In C++ you can, but > it's by default, so you get implicit construction even when the *type > author* didn't intend it to work.
Yeah, D does still have some dirty corners where built-in types still have "magical" behaviour. It's much better than other languages in this regard, though, AFAIK. T -- Why do conspiracy theories always come from the same people??
