is(x = module) vs. __traits(isModule, x)

Stefan Koch uplink.coder at googlemail.com
Thu Oct 8 08:24:52 UTC 2020


On Thursday, 8 October 2020 at 08:12:51 UTC, Kagamin wrote:
> On Wednesday, 7 October 2020 at 18:46:07 UTC, Steven 
> Schveighoffer wrote:
>> Why both? The first thing that struck me is that, std.stdio is 
>> NOT a type. `is` specifically says it works with types. So 
>> that seems out of place (indeed the documentation does not 
>> mention anything special about this).
>
> Guess, it's a bit of pl theory, I saw mentioned somewhere that 
> modules count as types. Not sure about packages though.

Well you can see a module as being the same as a singleton struct.
In D though Modules are not types. IIRC.


More information about the Digitalmars-d mailing list