lua-users home
lua-l archive

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


On Mon, Dec 17, 2012 at 12:12 AM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> On Mon, Dec 17, 2012 at 9:57 AM, Coda Highland <chighland@gmail.com> wrote:
>> obj:set{enabled=true}
>> Of these variations, Java-style is the shortest. :P
>
> Ah, but Dirk-style can set multiple properties in one go:
> obj:set{enabled=true,visible=true,name='Frodo'}.

I mentioned this two e-mails ago, and doing that adds additional
overhead to the setter (pairs() and a loop) and further worsens the
asymmetry between getter and setter.

>> I feel like there's got to be a good way to simplify this no matter
>> what method you're using.
>
> Thinking of upgrading Microlight's simple class mechanism to support
> properties, with as little fuss as possible.

I don't use Microlight from lack of need of it, but that sounds like a
great idea. :)

> You do know that one of the endless style wars in Java-land is
> 'getters are bad'.  Because they think it's just a tedious way to
> write a struct, and structs are not classes. Fortunately we work in a
> less dogmatic language community that isn't obsessed with sniffing
> other people's code for 'code smells' ;)

I avoid Java as much as possible so I actually didn't know that. I
hail from the Qt community, where we think the C++ community at large
is a little crazy and we mostly have an implicit agreement that Qt's
API style is pretty much the best you can do in C++.

/s/ Adam