auto: useful, annoying or bad practice?

Nick Sabalausky (Abscissa) SeeWebsiteToContactMe at semitwist.com
Fri May 4 09:12:45 UTC 2018


On 05/04/2018 03:56 AM, Laeeth Isharc wrote:
> On Friday, 4 May 2018 at 04:12:09 UTC, Nick Sabalausky (Abscissa) wrote:
>> On 05/02/2018 10:05 AM, H. S. Teoh wrote:
>>> [...]
>>
>> I don't doubt that. Similar to global namespace, if the structural 
>> typing is only used heavily by one or two components of a project (ie, 
>> libs, etc), then it's not too difficult to avoid problems. The real 
>> danger and problems come when a project uses several components that 
>> all make heavy use of either a global namespace (which D luckily 
>> doesn't really have) or structural typing.
>>
>> [...]
> 
> Have you seen Atila's concepts library?

Yea, last I checked, it doesn't address what I'm talking about at all. 
That lib's basically just this:

struct Foo {...}
static assert(isXYX!Foo);

But with more detailed diagnostics. (Plus it can help you write the 
isXYZ function.)

Unless something's changed since last looked at it, it didn't address my 
#1 key point: If struct Foo's author *doesn't* include the lib's 
"@models!(Foo, isFoo)", then isFoo!Foo should return false.


More information about the Digitalmars-d mailing list