lua-users home
lua-l archive

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


Hi everyone.

Sometime functions have a varible count of parameters. Most often we simply use ... as last parameter. Sometimes it is more expressive to use first parameters as optional arguments eg:

    function concat_path(drive, folder, filename);

In case we call this function with filename only, the function have to deal with the parameter count by itself and it works in many cases as we can see in many lua projects. BUT: The source code is less self descriptive.

A simple way do make the function parameters more descriptive would be to allow a "?" in identifiers. for instance:

  function concatPath(drive?, folder?, filename);

Still i have to deal with parameter counts by myself but the function header is much more self descriptive. And this patch interferes with nothing in existence.

Stupid idea?

greetings.
Ulrich Schmidt.