The __IMPLIED_TYPE__ macro is replaced by a reference to the type path implied at the current point in compilation. For instance, when using the new proc and assigning to a var, the type path for new() is implied by the var’s type. Implied types are also automatically used in locate(), and are used by default for the second argument in istype() and astype().

proc/Factory(new_type)
    world.log << "Creating new [new_type]"
    return new new_type()
 
proc/CreateThing()
    // pass /thing to Factory
    var/thing/T = Factory(__IMPLIED_TYPE__)

__IMPLIED_TYPE__ is valid in the following situations:

  • In an expression on the right-hand side of an assignment operator (this includes operators like +=), where the left-hand side is a var that has a defined type path.
  • Within the second argument of istype(). The implied type is the first argument’s var type.
  • Within the second argument of astype(). If the astype() call is on the right-hand side of an assignment, this is the type of the var being assigned to; otherwise it’s the type of the first argument.

This is actually a pseudo-macro; the preprocessor doesn’t handle it directly.

See also