D - more or less power than C++?
Johan Granberg
lijat.meREM at OVEgmail.com
Mon Mar 6 12:34:50 PST 2006
Hasan Aljudy wrote:
>> Because then i would have to call a method to read bar and that would
>> bee inefective.
>
> You know, CPUs are fast now a days, a single function call is not
> "ineffective".
That argument does not hold if you are in a tight loop it will matter.
>> I know it is no big deal when bar is only an ont but when larger
>> structures is copied the overhead can bee a significant slowdown.
>
> Objects don't get copied when they are passed to functions ..
But large structs does and if you want an objects variabls to bee
unchanged you muse use dup.
>> also privat does not protect from misstakes in the same class but if
>> you do a cast you will think about why it is readonly in the first place.
>
> I don't understand what you mean.
That readonly is for both the occasions when you misspell somthing and
refer to the wrong variable. (hard to find bug) and to present a user of
your library with a contract of use.
More information about the Digitalmars-d
mailing list