lua-users home
lua-l archive

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


Asger Ottar Alstrup wrote:
The syntax could be close to your proposal (although I think the typename should be optional always to preserve backwards compatibility), or a Haskell-type of syntax where the type information can be declared in separate lines.

As I have learned Pascal as first language, I would (naturally) ;-) prefer a style close to Pascal.

function do_something(n: Number, s: String): String
  local a, b, c: String = s, s..s, s..s..s
  return a..b..c..": "..n
end

function String do_something(Number n, String s)
  local String a, b, c = s, s..s, s..s..s
  return a..b..c..": "..n
end

In the cases I have thought of the use of the colon does not interfere with the method call. But there might be some. The grammar will show that.

I prefer the Pascal style declarations over the C style ones because the type of the variables (which is already defined) is separated from the variable names (which are undefined at that moment). And I find the syntax for the function's return type more readable.

Roland