Re: [suggestion] assert: accept functions as "message"-argument
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: [suggestion] assert: accept functions as "message"-argument
- From: Dirk Laurie <dirk.laurie@...>
- Date: 2013年1月17日 11:02:35 +0200
+1
2013年1月17日 GrayFace <sergroj@mail.ru>:
> I'm clueless why you would need it.
> Compare:
>
> assert(<condition>, function()
> return "hell".."o"
> end)
>
> to:
>
> if <condition> then
> error "hell".."o"
> end
>
> Second is better in every possible way.
>
> In your example of an externally declared function you can as easily make a
> function
> my_check(something, errorcode)
>
> Again it appears to be much nicer.
>
> --
> Best regards,
> Sergey Rozhenko mailto:sergroj@mail.ru
>
>