nothrow/@nogc inference troubles with emplace/move?

Dennis dkorpel at gmail.com
Wed Aug 28 21:37:07 UTC 2024


On Wednesday, 28 August 2024 at 12:57:24 UTC, Manu wrote:
> Yeah I get that... it's complex because there's not enough 
> passes; a lot is done in one or a few passes, so there's no way 
> to be confident that you can establish some compile-time facts 
> before you expect they could be used...

I wish attribute checking were a separate pass that was 
completely subtractive. I.e. it rejects programs with violations, 
but doesn't affect program semantics otherwise. But that's not 
the case with D's current feature set.

> I don't see any reason
> non-templates couldn't be subject to attribute inferrence too;

Inference for all came up in the last DLF monthly as something we 
want to pursue.

> just that
> they shouldn't have it mangled into the name.

That's an interesting aspect that didn't come up. It could be 
confusing when the listed function type differs from the de-facto 
type with respect to attributes, but worth considering.

> druntime, etc. Heaps of druntime is compatible with my code, 
> but because
> someone didn't put the attribute on it, I can't call it.

druntime and Phobos should be relatively well-annotated, but I've 
stumbled on missing `nothrow` and `@nogc` in Windows bindings 
before. If you have any specifics, please post them on bugzilla.



More information about the Digitalmars-d mailing list