What are the unused but useful feature you know in D?

Random D user via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 27 12:06:19 PDT 2017


On Monday, 26 June 2017 at 22:17:00 UTC, Moritz Maxeiner wrote:
> 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.
>

Yeah, that's true. I didn't really think of full source 
compilation of libs in your project. I though .lib would've been 
compiled with some settings and you'd just link with that and 
work with its api.

Also in reality I wouldn't want to be able to cancel @nogc in a 
function, because then the attribute would just lose power and 
you couldn't trust it. I just used it as a simple example for the 
@ and @! syntax that I'd like to have in general. Which would 
allow a nice way of working with sections of code like this:
class
{
@nogc:    or @!gc:
... some code ..
@gc:    or @gc:
... more code ..
@nogc:    or @!gc:
... even more code ..
}

>>
>> 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.

Hmmm, I guess that's true. I don't really know a lot about Rust. 
Their safety story just sounds way more convincing and believable 
than D's. It would probably be the first language I'd look into 
if I was interested in low level safety critical code.




More information about the Digitalmars-d mailing list