-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mention Conditions that Can Abort Author Code #52
Comments
Not Only Verbs ...Actually, this issue should deal with any sort of code execution planned by the author and which could fail due to some instructions failures. (issue renamed!) In 5.1. A Turn of Events we find the description of all the type of executions that can take place on every turn, and their order of execution:
Unfortunately, the Manual doesn't provide an explicit term to refer to all of them — whereas it would be useful to have one, especially when discussing this context — but we find mention of "execution of a sequence of statements" (e.g. in §3.7, spekaing of CONTAINER Limits properties). NOTE: In §2.3. Alan Fundamentals » What’s Happening? we find a general resume of how verbs, events and scripts control dynamic aspects of an adventure. Potential Execution Interrupting Instructions
Exits?
This needs to be tested, for I'm not sure if Current Manual ReferencesNow, let's look at where we find mentions of this topic in the Manual, before deciding were we need to add more contents... Container LimitsIn 3.7. Properties » CONTAINER Properties » LIMITS we find (bold added):
In the above, the sentence "and the players turn aborted" seems to suggest that the whole turn ends — i.e. if failure occurs inside a
In 3.17. Statements » Manipulation Statements » LOCATE Statement we find (bold added):
Containers ExtractIn 3.7. Properties » CONTAINER Properties » EXTRACT we find (bold added):
Here "abort the move" implicitly means aborting the execution context that triggered the The sentence "abort the move" seems to indicate that the whole turn will be forfeited. (see my previous note) Script FailureIn 3.7. Properties » SCRIPTs we find mention of
Here it mentions
|
@thoni56,
I've realized that The ALan Manual doesn't clarify in the
VERB
s section that a failedLOCATE
statement could interrupt (abort) the whole verb execution.This is a source of confusion even among expert users, for example you'll find that the StdLib uses IF clauses after an implicit-taking to check that the implicit take succeeded. E.g. from
lib_classes.i
, verbgive
onliquid
:The problem here is that there's no need to carry out that check, for if the
LOCATE
statement in the implicit-take action were to fail for any reason (e.g. the object is held by an actor) then the rest of the verb execution would be aborted, so there's no risk (nor chance) that the rest of theDOES
body is executed anyhow — therefore the wholeIF
clause surrounding the final part of the verb is unneeded.But besides the redundant code, the big risk is that authors might thing that they could handle failure of a
LOCATE
statement by carrying out alternative code via anIF
clause, whereas that code is actually never executed! So, probably custom verbs that rely on aLOCATE
statement should verify its failure conditions before attempting it, in case they need to carry out alternative actions if that is not viable (e.g. a specific message beyond that of theEXTRACT CHECK
that would prevent dislocating the item).Unfortunately, this aspect of Alan
VERB
s is not covered clearly in the Alan Manual. I think it's really important to clearly mention all the possible conditions that could interrupt the execution of aVERB
body, and some tips on how to handle this in real case scenarios (especially, how to handle such code abortions in custom verbs).For more info, see also:
This issue is also mentioned in:
The text was updated successfully, but these errors were encountered: