Skip to content

Add NOP Instruction #14

Description

@tajmone

REQUEST

Add a new NOP instruction to do nothing.

Possible syntax: NOP, DO NOTHING, NOTHING.

RATIONALE

In various occasions I've come across the need of a NOP instructions, e.g. when I'm forced to rely on the ELSE part of a condition containing an expression that can't be NOT-evaluated, or because I needed a temporary placeholder while drafting some code changes.

As a practical example, class expression can only be positively evaluated, so it's not possible to use If X NOT IsA someclass (e.g. when trying to affect only instances of the ancestor class, when targeting an attribute that is inherited along the line).

The closest thing to a NOP right now is printing an empty string, but this is not possible inside RULEs:

WHEN location OF hero IS lit
  THEN
    IF location OF hero IsA cave
      THEN "" -- do nothing! (doesn't work)
      ELSE
        -- Whatever needs to be done on `lit` locations that
        -- are not cave instances...

The above example (possibly not 100% correct) roughly illustrates where a NOP instruction would be useful.

Hopefully, implementing a NOP shouldn't be too complex, nor have unexpected side effects (since it does nothing), and wouldn't affect backward compatibility.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    💡 feature requestNew feature request⭐ 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