lua-users home
lua-l archive

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

Hi all,

Lua has been said to operate by the principle of 'least surprise' -

but I was surprised that string methods apply to string variables, but
raise an exception with literals:

s = "abcd" ; print(s:match("^%x%x"))



I guess I mentally apply a kind of
instantiation-doesn't-change-semantics principle here, hence the surprise.

Question: any deeper reasons for the above behaviour? Can/should this be