What are the unused but useful feature you know in D?
Moritz Maxeiner via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 26 15:17:00 PDT 2017
On Monday, 26 June 2017 at 18:47:18 UTC, Random D user wrote:
> Anyway, I think we could just have a compile time switch for
> defaults.
Imagine having n libraries with pairwise different required
defaults used in your application. Say goodbye to combined
compilation, hello n separate required compiler invocations.
> Since some projects want to have pure, @safe, immutable by
> default, but others want to have @system @nogc. And no one
> wants write attributes more than they have to.
That's why most of what I do is in templates, so the compiler
infers them for me, anyway.
>
> Also I think @safe is a little bit broken (because of @trusted
> and even the very pros (d-devs) seem to get @trusted wrong on a
> regular basis (at least that's my perception)). Just bite the
> bullet and use Rust if you want to be actually safe.
Except Rust is in exactly the same boat as D, because the same
issues that apply to `@trusted` apply to `unsafe`, as well.
>
> Which reminds me that it would be nice to group attributes as
> well.
> Something like this:
> alias @apiStrict = @safe immutable pure
>
> int foo() @apiStrict
> {
> return 1;
> }
That would be useful.
More information about the Digitalmars-d
mailing list