std.traits.ParameterIdentifierTuple problem

Carl Sturtivant sturtivant at gmail.com
Tue Apr 2 13:38:05 UTC 2024


On Monday, 1 April 2024 at 18:28:16 UTC, Nick Treleaven wrote:
> On Sunday, 31 March 2024 at 23:05:44 UTC, Carl Sturtivant wrote:
>>> Yes, it's not possible to instantiate a function type.
>>
>> But with extern it seems the semantics is fine as a function 
>> is not being instantiated. It is merely associating a name 
>> with a type: in what sense is this instantiation in any 
>> reasonable way?
>
> Yes there is no instantiation for extern. But what would be the 
> use of allowing an extern function type instance, when there's 
> no way to instantiate it?

1. For compile time work that uses the name but not the function 
it nominally refers to. That's what I wanted it for: 
`ParameterIdentifierTuple` might actually work on that.

2. In fact the definition might refer to a function defined in 
another module, for example brought in by ImportC. It's an 
alternative way of writing the signature of an external function. 
Why rule it out when it is reasonable?

The first could also work with an explicitly uninstantiated 
function, as in `enum FUNCTYPE f = void;` hence my second attempt 
above.

As long as there are compile-time actions that work on functions 
but not their types, this would be a way to work around that.




More information about the Digitalmars-d-learn mailing list