lua-users home
lua-l archive

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


On Thu, Dec 30, 2010 at 15:49, Steve Litt <slitt@troubleshooters.com> wrote:
> On Thursday 30 December 2010 07:30:31 Axel Kittenberger wrote:

>> Personally I too consider for a language that presents itself as easy
>> and the code looking tidy, the # notion an unfortunate stumbling block
>> I'm sure many more people will get their nose bloody.

> Which brings us full circle to when somebody asked me why one should have
> obj.setx("whatever") instead of just setting x. obj.setx("whatever") could see
> whether obj["x"] exists, and if not increment obj["numberOfElements"] so that
> obj["numberOfElements"] represents the true number of elements. But the minute
> a hurried and uninformed maintenance programmer sets an element directly
> (obj.x="whatever"), all bets are off and the program breaks far away from the
> maintenance programmer's mistake.

You should politely explain to this programmer that he is wrong (level
of politeness and means of explanation, of course, depend on the
corporate culture and the amount of damage). Otherwise we'd come to,
say, rewriting os.execute, so it would not accept a fork bomb as an
argument.

Besides, the proper way of protection here is a proxy metatable, not
setx() method.

That being said, I must note that I'm for the maximum feasible
strictness and validation myself — as long as it is practical — but
you have to draw a line somewhere. Otherwise you will come into
stasis.

Alexander.