lua-users home
lua-l archive

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


On Tue Apr 04/29/14 at 12:20, steve donovan wrote:
> On Tue, Apr 29, 2014 at 12:07 PM, Paige DePol <lual@serfnet.org> wrote:
> > I can see the utility of the `?` at the end of a function name, perhaps
> > even the `!`, though the same can be achieved without the symbols via
> > naming conventions.
> 
> It does read nicely, but to be effective _everyone_ must use that style,
> and it's hard to enforce conventions at the language level.

This argument has come up a number of times, but I don't think it carries
that much weight.

Any convention is just that, a convention. Some people will follow it, and
some won't. It is true that allowing `?` at the end of predicate functions
cannot *enforce* the convention, but so what? As you say, it's difficult to
enforce any convention at the language level. As things are, some people
use `isodd`, `is_odd`, `odd` or many other names to test whether a number
is odd. Again, so what? Some people use `camel_case` and others use
`snakeCase`. (The Rio folks seem to prefer `oneword`.) Does this mean that
Lua shouldn't allow all three options?

The vast majority of Lua code that I deal with is written by me. And if `?`
were available, I would use it consistently. That would be a very big
benefit for me, regardless of what anyone else did or didn't do.

In my experience so far (a couple of years in), Lua programmers are very
varied in their habits and conventions. So the argument that *everyone*
must do something or it's not worth allowing for seems to rule out *any*
conventions.

Sorry to go long, but this has been bugging me.

Peter
-- 
We have not been faced with the need to satisfy someone else's
requirements, and for this freedom we are grateful.
    Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System