lua-users home
lua-l archive

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


rw20@cornell.edu wrote:
> Steve,
> 
> Looks like some nice code.  Couple of questions: shouldn't empty_ set 
> count to 0?  

Yup, that's a bug - thanks!

> why do you use xxx_ for method names?  It seems cluttered.  
> I can understand using something like that to indicate "private" methods.

I used "_" to indicate how arguments fit into the message name.
For example:

 collection:insert_at_(myObject, 1)

means:

 collection insert:myObject at:1
 
 (notice how it's clear what the arguments do)

If the message was just:

 collection:insertAt(myObject, 1)

It's not clear what the message means without documentation.
For example, it looks like it could mean that it will find "myObject"
in the collection and insert "1" at it's position.

The underscore also allows me to implement automatic getters and setters
for method calls, so everything can be a message.

Steve