UFCS for D

Nick Sabalausky a at a.a
Fri Mar 30 12:54:08 PDT 2012


"deadalnix" <deadalnix at gmail.com> wrote in message 
news:jl47vt$1old$5 at digitalmars.com...
> Le 30/03/2012 07:29, Nick Sabalausky a écrit :
>> "Steven Schveighoffer"<schveiguy at yahoo.com>  wrote in message
>> news:kgwyziwlndczqtafbvrf at forum.dlang.org...
>>> On Friday, 30 March 2012 at 01:55:23 UTC, Nick Sabalausky wrote:
>>>>
>>>> Yea, that occurred to me, too.<wishful musing>I've been starting to
>>>> think
>>>> more and more that the "everything in a module is a friend" was a
>>>> mistake,
>>>> and that we should have instead just had a "module" access specifier 
>>>> like
>>>> we
>>>> have "package".</wishful musing>
>>>
>>> I don't think it was a mistake, it makes perfect sense to me.  On the
>>> other hand, I fully understand why Meyers' prescription is useful for
>>> humongous code bases.  However, I don't see this causing much trouble 
>>> for
>>> code I write.
>>>
>>> For instance, you have two classes you may have put into the same module
>>> because they are categorically related (not necessarily friends in C++
>>> terms).  It's highly unlikely that you "accidentally" access private
>>> information across the classes.  So how much time is "wasted" checking 
>>> the
>>> other class for external references?  Probably none.
>>>
>>
>> Large portions of D's access specifiers were completely unenforced for a
>> long time and it never caused me much trouble. Doesn't mean they didn't
>> still need to enforced.
>>
>>
>
> Because projects were small.

Right, my point is, just because you're not accidentally accessing things 
you shouldn't, doesn't mean those safeguards shouldn't still be in place. At 
the very least it makes it easier to reason about the code: You can just 
look at it and *know* there's no improper access going on. No need to tiptoe 
around keepng an eye out for it on the off chance that you or someone else 
did manage to slip something in there accidentally *or* deliberately.




More information about the Digitalmars-d-announce mailing list