[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: behaviour of assert on non-string errors
- From: Andrew Starks <andrew.starks@...>
- Date: Sat, 18 Jan 2014 10:28:44 -0600
On Saturday, January 18, 2014, Dirk Laurie <dirk.laurie@gmail.com> wrote:
2014/1/18 Philipp Janda <siffiejoe@gmx.net>:
> I think we already had this discussion a year ago[1].
> [1]: http://lua-users.org/lists/lua-l/2013-01/msg00084.html
So we did, and certain people still think the same way as they
did then. :-)
A discussion on what is best might make for some good sport. And also it is true: people often use assert as short hand for:
if not x then error("you must supply x." ) end
...which, in fact, is a paraphrase of the example in PiL and that is as close as it gets to "blessing" an idiom as the is in Lua.
So then there is the question of changing a behavior that others rely on. Don't see that here... Adding complexity to the language? Nope. Making things harder for those that don't see a need for this flexibility? I don't think so. And on and on.
But then there is the question of complexity in Lua's implementation, and the added tests and maintenance required.
So, instead of saying that it should be in there, my opinion is that if if were, it'd be valuable to me and the slow-down that would happen upon erroring would not at all be something that would matter. That said, I often wrap assert and don't really use it in the repl.
-Andrew
- References:
- behaviour of assert on non-string errors, Justin Cormack
- Re: behaviour of assert on non-string errors, Andrew Starks
- Re: behaviour of assert on non-string errors, Justin Cormack
- Re: behaviour of assert on non-string errors, Andrew Starks
- Re: behaviour of assert on non-string errors, Elias Barrionovo
- Re: behaviour of assert on non-string errors, Peng Zhicheng
- Re: behaviour of assert on non-string errors, Dirk Laurie
- Re: behaviour of assert on non-string errors, Justin Cormack
- Re: behaviour of assert on non-string errors, Dirk Laurie
- Re: behaviour of assert on non-string errors, Philipp Janda
- Re: behaviour of assert on non-string errors, Dirk Laurie