Sealed classes - would you want them in D?
Jesse Phillips
Jesse.K.Phillips+D at gmail.com
Wed May 16 13:09:22 UTC 2018
On Wednesday, 16 May 2018 at 02:05:29 UTC, KingJoffrey wrote:
> On Tuesday, 15 May 2018 at 15:19:33 UTC, Jesse Phillips wrote:
>> On Tuesday, 15 May 2018 at 10:19:58 UTC, KingJoffrey wrote:
>>> My own code in D had bugs, cause I didn't realise all my
>>> private parts were not just visible, but accessible by all
>>> the so called 'friends' around me. They could reach in a do
>>> whatever they want! Without my consent!
>>
>> You've peaked my interest, could you give some details on one
>> or more of these bugs?
>
> It's simple.
>
> Write a non-member function, contained in the same module as a
> class, and accidently use a private class member instead of the
> public getter/setter defined by the interface of that class.
>
> It's human error, that will occur time and time again, but will
> *never* get picked up in D, except through a debugging session,
> because D does not consider this an error.
>
> How can it, if private is not really private?
>
> Now the burden is back on the programmer again.
>
> Be careful what you put into a module.
That isn't a bug. What is the software use case? How did this
case differ because someone did this?
Global variables and singletons are also frowned on, but call it
bad coding not a bug.
More information about the Digitalmars-d
mailing list