Thanks, I take your point.
(Update)
Now I have owned a deeper understanding. Therefore share my opinion:
The problem with do
syntax is that it has an underlying unintuitive implication
- passing the function defined in
do
block as the first argument
Therefore the odds are that
But in sheer appearance,
fun() do
a = 14
end
seems to suggest that a = 14
is done at that line.
I browsed some discussions and find that there are also people who don’t get used to using do
block. e.g. here.
So we can write
local function af()
a = 14
end
fun(af)
in place of any do
syntax.