struct vs class

spir denis.spir at gmail.com
Sun Nov 14 04:25:54 PST 2010


On Sun, 14 Nov 2010 12:02:35 +0000
div0 <div0 at sourceforge.net> wrote:

> > Both of these points may conflict with semantic considerations above:
>  > we may want to use structs for fast creation, but if ever they mean
>  > "things", we must think at referencing them manually and/or using
>  > ref parameters. We may want to use classes for light passing,
>  > but if they mean values, we must either never assign them or
>  > manually copy their content. It's playing with fire: very
>  > dangerous risks of semantic breaks in both cases...  
> 
> Perhaps, but they are tools to implement a program design;
> it's the program design that should be driving your choices not abstract 
> semantic considerations. Go down that route and you'll never get 
> anything done.

I do not really get what you mean with "program design" as opposed to "semantic considerations". I tend to think that "program design" should precisely be driven by "semantic considerations" -- and that it's the main purpose of good language design to allow this as straightforwardly as possible. A bad langage is for me one in which one can hardly express what is meant -- leading to what I call "semantic distorsion" ;-).
So, what is "program design" for you?

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d-learn mailing list