types.Null.constructor
nullReturns null. This is what runs when types.Null itself is called, types.Null().
Return value
Always null, regardless of any arguments given.
Notes
null is the only value in this class, so unlike every other type's constructor there is nothing to convert: any arguments are read off the stack and thrown away, never inspected, so types.Null(1, 2, 3) is legal and still gives null. This never throws.
null has no other method - not tostring, tointeger, tofloat, clone or weakref. Calling any of those on null throws the index '<name>' does not exist, the plain missing-slot error, not a type-specific one. null still formats as "null" when print or string concatenation converts it implicitly, since that path does not go through a method lookup; see types.Bool.tostring for the same contrast on a type that does have the method.
constructor is a reserved word, but the parser special-cases it after a dot, so null.constructor() parses like an ordinary method call even though null has no other reachable methods.
Example
let types = require("types")
println("types.Null() =", types.Null())
println("types.Null(1, 2, 3) =", types.Null(1, 2, 3)) // extra arguments are accepted and ignored
println("type(types.Null()) =", type(types.Null()))
// unlike clone, "constructor" is not keyword-blocked after a dot
println("null.constructor() =", null.constructor())types.Null() = null
types.Null(1, 2, 3) = null
type(types.Null()) = null
null.constructor() = nullSee also
constructor | Converts value to a bool. This is what runs when types.Bool itself is called, types.Bool(value). |
constructor | Converts value to an integer. This is what runs when types.Integer itself is called, types.Integer(value). |
type | Returns the name of obj's type. |
classof | Returns the class that obj belongs to. |
| null | class index |