Struct-typing in Phobos

Chris Williams yoreanon-chrisw at yahoo.co.jp
Tue Feb 4 12:11:04 PST 2014


Really, my only intent was to write the article about how to use 
these, not to argue for/against classes, but my preface got 
longer than intended. I'll make sure to note the possibilities 
offered by alias this (but will wait to see if anyone has any 
further updates to suggest before posting an updated version). I 
don't think that UFCS counts as extensibility. You can't add 
variables to your instances, just add helper functions.


On Tuesday, 4 February 2014 at 13:01:28 UTC, Dicebot wrote:
> I find structs completely superior to classes as design base 
> and only resort to latter if find myself in need of polymorphic 
> behavior.

A person who is using Phobos has no option to switch to classes 
when they find that they need polymorphic behavior, except by 
copy-pasting into a new source file and revising the Phobos code 
outside of Phobos.

If there aren't really any speed or size advantages of 
significance, then what are you considering to make structs 
superior? (I ask since I would rather make an argument for 
struct-typing in the article, so people understand the decision.)


More information about the Digitalmars-d mailing list