lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Dec 27, 2010 at 7:06 PM, Tomas Guisasola Gorham
<tomas@tecgraf.puc-rio.br> >        I do.  But I do not divide code
into modules to achieve privacy,
> but to improve reuse and ease maintenance.

Yes, I sometimes don't get the 'privacy' thing, which becomes a kind
of religion with languages like Java.  Encapsulation is good policy,
but there has to be some basic trust with your collaborators. The
no-nonsense module style (everything local except explicitly exported
functions) means that the implementation is not too leaky, but people
can always monkey-patch. I know this is considered cool in the Ruby
world, but it's really asking for trouble.

But to organize code so that foolishness or excessive cleverness is
impossible? That seems like unnecessary hard work. Languages like Java
are concerned with enforcing the 'letter of the law' with
encapsulation, whereas it is better to respect the spirit.

steve d.