mruby/mruby — pull request #1718 by cremno (2014-02-17 12:13:11+00:00)
Title: feature: add mrb_fatal

**mrb_state.fatalf**
- synopsis: ```typedef void (*mrb_fatalf)(struct mrb_state *, const char *);```
- an error message is optional (2nd argument == NULL)
- may be used to “rescue” a fatal error if an abort(3) call is undesirable
- by default a nonnull error message and '\n' will be written to stderr(3)

**mrb_fatal**
- calls ```(*mrb_state.fatalf)()``` if it is not NULL
- calls abort(3) if ```(*mrb_state.fatalf)()``` is NULL or returns

And a somewhat related fix:
add_gray_list: prefer an assertation and MRB_TT_MAXDEFINE is invalid, too

This (or at least a very similar) feature was already discussed in the past but the proposed name was ```mrb_panic```. I don't have a strong opinion on the name. I just renamed it because I think **fatal** feels more “natural” to Ruby programmers - even though here it isn't an exception like in CRuby.

See #1064 for a previous discussion and #1700: maybe this feature could have been helpful here but that question wasn't answered yet.
And for a description of Lua's panic function.