# __IMPLIED_TYPE__ macro

Source: https://ref.dm-lang.org/DM/preprocessor/__IMPLIED_TYPE__
Added in BYOND 515.

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](https://ref.dm-lang.org/proc/new.md) 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()](https://ref.dm-lang.org/proc/locate.md), and are used by default for the second argument in [istype()](https://ref.dm-lang.org/proc/istype.md) and [astype()](https://ref.dm-lang.org/proc/astype.md).

```dm
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()](https://ref.dm-lang.org/proc/istype.md). The implied type is the first argument's var type.
* Within the second argument of [astype()](https://ref.dm-lang.org/proc/astype.md). If the [astype()](https://ref.dm-lang.org/proc/astype.md) 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
- [__FILE__ macro](https://ref.dm-lang.org/DM/preprocessor/__FILE__.md)
- [__LINE__ macro](https://ref.dm-lang.org/DM/preprocessor/__LINE__.md)
- [__PROC__ macro](https://ref.dm-lang.org/DM/preprocessor/__PROC__.md)
- [__TYPE__ macro](https://ref.dm-lang.org/DM/preprocessor/__TYPE__.md)
- [new proc](https://ref.dm-lang.org/proc/new.md)
- [locate proc](https://ref.dm-lang.org/proc/locate.md)
- [istype proc](https://ref.dm-lang.org/proc/istype.md)
- [astype proc](https://ref.dm-lang.org/proc/astype.md)
