lua-users home
lua-l archive

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


2014-08-29 10:21 GMT+02:00 Thijs Schreijer <thijs@thijsschreijer.nl>:

>> There should be one and only one reason ever to change a name:
>> because the new name is used for something different.
>
> Not necessarily. The examples shown (coroutine/thread and lua_State)
> are pure legacy, if not now, then sometime in the future you'll have to
> clean that up, simply because over time you'll be accumulating more
> and more. And even then backward compatibility is only one #define
> away (for the c api at least)

As far as I am concerned, a lua_State* is something I can pass to
an API routine, containing all the information about necessary stuff
that a user of the API does not need to know. If Roberto and friends
think of that information as a "state", that is good enough for me.

Likewise, if they can write a logical sentence in which the words
"thread" (in the Lua sense) and "coroutine" both appear [1], I do
not consider it proper to tell them it's the same thing. Instead, one
should devote some time pondering the implications of the word
"implement" in that sentence.

So neither of those examples is "pure legacy".

Here is an example of a justified name change:

   Lua 5.1: luaL_register
   Lua 5.2: luaL_setfuncs

Inside module code, they are very similar. Where you used to put
luaL_register(L,NULL,lib), you now put luaL_setfuncs(L,lib,0).
But they have different argument lists, and when all three
arguments are non-trivial, the extra tasks they do are different.

[1]  "The type `thread` represents independent threads of execution
   and it is used to implement coroutines." Lua 5.2 manual, §2.1.