Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Name:
Email:
Subject:
Message icon:

Verification:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?:

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: Wisp
« on: November 26, 2018, 12:17:36 PM »

TRY is generally not safe without RERAISE because WeiDU has little exception safety. If you do something, state is changed (this can be internal state not visible to TP2), an error occurs which you catch and from which you continue and state may inappropriately remain changed, instead of the change being reversed. This may not necessarily be "serious", for instance, a file handle might remain open, but it has a potential of causing more or less subtle problems. In the specific case of testing for a function, it is safe, because launching an undefined function has no side-effects before the error occurs.
Posted by: DavidW
« on: November 26, 2018, 11:17:25 AM »

I notice that the current WEIDU readme has a stern warning about PATCH_TRY and ACTION_TRY being unsafe (or safe only when used with _RERAISE, i.e. not safe in the context of continued execution). Is this "not safe" in the sense of "if you don't know what you're doing, you'll try using this as a workaround for broken code and make a horrible mess of your mod", or in the sense of "even if you do know what you're doing, subtle WEIDU errors may occur"?

I ask because I use _TRY quite a bit in SCS's function libraries - partly because the only way I currently know to detect if a string names as function is to TRY running it and then catch the function-does-not-exist error, partly because it's a good way to stop SCS choking if it runs into a broken file from someone else's mod (I'd rather throw a WARNING than have the install fail and then get blamed).

Insight welcomed.