What's dxml DOMEntity(R) type ?

Steven Schveighoffer schveiguy at gmail.com
Tue Jun 6 16:36:05 UTC 2023


On 6/6/23 12:15 PM, Ferhat Kurtulmuş wrote:
> On Tuesday, 6 June 2023 at 14:16:37 UTC, Steven Schveighoffer wrote:

>> In general, the easiset thing to do is use typeof, though it's not 
>> always pretty (and not always obvious how to write it). However, it's 
>> required for voldemort types.
>>
>> ```d
>> typeof(parseDom("")) DomEntity;
>> ```
>>

> İt is one of the nicest features of d. I believe it should not be used 
> too often because it may cause longer compilation times, worse code 
> reading, less comfort with d code scanners, editors etcetera.

It should not affect compile times at all. If you are going to 
instantiate it that way, it will need to be compiled regardless. 
`typeof` is very low cost, as it's a direct call on the compiler internals.

Something like `ReturnType!Foo` is different.

-Steve


More information about the Digitalmars-d-learn mailing list