RELEASE LiveCode 6.6 DP1
Peter Haworth
pete at lcsql.com
Sun Feb 16 16:13:26 EST 2014
Thanks for the explanation Mark.
Been prowling around the web for information on assert and I think I'm
getting clearer on its use. Seems like it's really meant to detect the
infamous "this should never happen" situation rather than expected errors.,
kinda like a switch default statement to show an error message because the
case statements covered all the theoretically possible options.
But then you said:
"I use asserts all the time in my real-world coding, and I welcome their
introduction to the LC world."
And here I was thinking I was writing real world code :-)
Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
On Sun, Feb 16, 2014 at 9:40 AM, Mark Wieder <mwieder at ahsoftware.net> wrote:
> Pete-
>
> Sunday, February 16, 2014, 9:11:23 AM, you wrote:
>
> > All valid points. I'm just not seeing any big advantages over using
> if/then
> > constructs, but I can see that being a personal preference.
>
> Well, one advantage of assert is that the parameters pinpoint exactly
> where the error occurred, making your debugging and logging tasks
> easier. You don't need a switch statement to see what type of problem
> and where it happened, the engine hands that to you, and you can log
> it, display it in an answer dialog, whatever you want.
>
> You can ship code with assert commands in place, as they should be
> harmless and only come into play if something fails. Then when you
> change code your tests will tell you if something's going to break.
> You also have an extra bug reporting mechanism on the client end of
> things: if something happens to break your code even though it passed
> your dev tests, you can pop up the same log information and the your
> users can relay that back to you.
>
> Granted you could do all this without an assert command in the engine,
> and we've done that for years, but this makes things easier, cleaner,
> and helps the engine team ensure that they can catch bugs before they
> release builds to us. I use asserts all the time in my real-world
> coding, and I welcome their introduction to the LC world.
>
> That said, I think the assert command is still in its infancy, as it
> won't catch things like
>
> assert 1 / 0
>
> --
> -Mark Wieder
> ahsoftware at gmail.com
>
> This communication may be unlawfully collected and stored by the National
> Security Agency (NSA) in secret. The parties to this email do not
> consent to the retrieving or storing of this communication and any
> related metadata, as well as printing, copying, re-transmitting,
> disseminating, or otherwise using it. If you believe you have received
> this communication in error, please delete it immediately.
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list