Built-in functions
Every variable or constant (simple or complex) has built-in functions. They can be accessed like any other function even on a literal. Every built-in function can be overriden.
nameof
nameof returns the name of a variable as a string. It can be used both with and without a parameter.
With parameter
Example
var a = 42
nameof(a) //returns 'a'; the nameof function of the `this` scope is calledWithout parameter
Example
with console from std:io
console.nameof() //returns 'console'type
type returns the type of an object as an atom.
Example
equals
equals compares two values and returns true if they're equal and false if they're not.
Example
hash
For complex types (except protos), hash serializes the variable into a JSON, MD5-hashes the JSON string and returns it. For simple types, the MD5-hash of the string representation of the value is returned.
Example
toString
toString returns the string representation of any variable or literal. Objects or structs are serialized into JSON while simple types are just being converted to strings.
Example
send & self
send sends an object to the specified PID.
self returns the pid of the calling process.
Example
Last updated