why std.stdio.File is a struct?

Chris via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 21 04:32:14 PDT 2016


On Thursday, 20 October 2016 at 12:24:14 UTC, ketmar wrote:
> On Thursday, 20 October 2016 at 07:40:05 UTC, Jonathan M Davis 
> wrote:
>> In general, in D, if you don't need inheritance and 
>> polymorphism, you probably shouldn't be using a class.
>
> and even if you need, most of the time it is better to write 
> templated free functions with constraints instead. ;-)

I use a few classes, but mainly to structure the program (some 
are singletons). The rest are all structs and functions/templated 
functions. On hindsight, I would probably not go down that path 
again. Better avoid the class system altogether, ask the British 
;)


More information about the Digitalmars-d mailing list