lua-l archive
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
] [
Date Index
] [
Thread Index
]
Subject
:
Re: Syntax sugar for default arguments
From
: Sven Olsen <sven2718@
...
>
Date
: Sun, 21 Apr 2013 16:29:15 -0700
function f(x,y=0) --> function f(x,y) y= y==nil and 0 or y;
Ok, I'm wrong. There's a bug in my semantic. What you actually want is probably:
function f(x,y=<const _expression_>) --> if y ~= nil then y= <const _expression_> end
Piggybacking on OP_OR or OP_AND just leads to all sorts of trouble in the boolean cases.
-Sven
References
:
Syntax sugar for default arguments
,
Dirk Laurie
Re: Syntax sugar for default arguments
,
Steve Litt
Re: Syntax sugar for default arguments
,
Dirk Laurie
Re: Syntax sugar for default arguments
,
Enrico Colombini
Re: Syntax sugar for default arguments
,
Sven Olsen
Prev by Date:
Re: Syntax sugar for default arguments
Next by Date:
lua_close crash down the application
Previous by thread:
Re: Syntax sugar for default arguments
Next by thread:
Re: Syntax sugar for default arguments
Index(es):
Date
Thread