memcpy() comparison: C, Rust, and D

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 1 15:49:29 PST 2017


On Wed, Feb 01, 2017 at 11:49:25PM +0000, Mike via Digitalmars-d wrote:
> On Wednesday, 1 February 2017 at 21:47:58 UTC, Adam D. Ruppe wrote:
> > (actually in the real world, it won't since nobody will care enough
> > to write `pure public return const(T) hi(return scope T t) nothrow
> > @nogc @safe @noincompetence @a_million_other_things { return t; }`)
> 
> I found all the attribution of function definitions a little unnerving
> when I started learning D, but at least one other believed it was
> idiomatic D.

I think the goal, if it's possible to attain to eventually, is to have
the compiler infer most of the attributes, ideally all.  This is already
done for a good number of attributes for template functions and auto
functions.  I agree with you that attribute soup is a Bad Thing for a
language.


> It makes me wonder if D has the wrong defaults (though probably a moot
> point if changing it would break code).  But, it does place D at a
> disadvantage to a language like Rust, where one has to opt-out of
> safety, while in D it appears to be opt-in.
[...]

We would love to change the defaults, but unfortunately that boat has
already sailed a long time ago.  If we could do it all over again, I'm
sure a lot of defaults would be the opposite of what they are today.
But we can't reasonably change that now without massive breakage of
current code.


T

-- 
Life begins when you can spend your spare time programming instead of watching television. -- Cal Keegan


More information about the Digitalmars-d mailing list