Skip to content

Needed: Try/Catch for Dry-Running Instructions #15

Description

@tajmone

I'm adding here this feature request as a reminder of what was already discussed in AnssiR66/AlanStdLib#57 regarding the need to introduce some syntactic construct that allow testing if a given action would be achievable, before actually carrying it out.

The need rose from the realization that VERBs, SCRIPTs, RULEs and EVENTs might clash with container's constraint when attempting to dis-locate an object from one place to another, and that the failure to EXTRACT the object would interrupt the VERB (etc.) execution without warning.

E.g. some verbs might require implicit taking (e.g. eating or throwing something that the hero doesn't posses but it's in the vicinity). The problem is that currently there's no way to test if attempting to move the object (e.g. into the hero's inventory first) would succeed or fail, so in case of failure the VERB interrupts execution abruptly without allowing to print an adequate message.

Having access to a special instruction that would allow to "dry-run" an instruction, returning true/false, would allow to handle such cases.

In the previous discussions various solution were proposed, along the line of TRY/CATCH, but it didn't develop anywhere beyond drafty ideas. So I though of creating this Issue here, since in the meantime the ALAN repo was moved from Bitbucket to GitHub, and the newsletter archives were deleted from Yahoo.

I've also created the limitations label for this type of Issue, because I vaguely remember an old email exchange proposing to store somewhere the various discussion on current limits of the ALAN language.

Metadata

Metadata

Assignees

No one assigned

    Labels

    💡 limitationsCurrent limitations of ALAN Language, and possible solutions⭐ ALAN LangTopic: The ALAN Language and its instructions set

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions