Erlang
Erlang — Gateway to the BEAM ecosystem.
Erlang is a ProtoObject subclass that provides access to all Erlang
modules via message-send syntax. Sending a unary message with a module
name returns an ErlangModule proxy that forwards subsequent messages
as Erlang function calls.
Examples
Erlang lists reverse: #(3, 2, 1) // => [1, 2, 3]
Erlang erlang node // => the current node atom
proxy := Erlang maps // => #ErlangModule<maps>
proxy merge: #{#a => 1} with: #{#b => 2}
Design
Erlang uses @intrinsic on doesNotUnderstand:args: so the compiler
generates inline proxy construction rather than routing through a
gen_server process. See ADR 0028 §1.
Instance Methods
Look up an Erlang module by name, returning an ErlangModule proxy.
Invoked automatically when an unknown message is sent to the Erlang
singleton. The selector becomes the module name; arguments is
always empty for unary lookups.
Compiled via @intrinsic erlangModuleLookup — no gen_server roundtrip.
Examples
Erlang lists // => #ErlangModule<lists>
Erlang maps // => #ErlangModule<maps>
Inherited Methods
From ProtoObject
Test value equality (Erlang ==, non-strict — 1 == 1.0 is true).
Examples
42 == 42 // => true
"abc" == "abc" // => true
Test value inequality (negation of ==).
Examples
1 /= 2 // => true
42 /= 42 // => false
Test strict value equality (Erlang =:= — 1 =:= 1.0 is false, unlike ==).
Every object supports this at runtime (it lowers directly to Erlang's
=:= operator regardless of receiver type, ADR 0002) — declared here,
once, so it is visible in method listings/completions/respondsTo: for
every class, not just the handful (Integer, String, ...) that
separately redeclare it with a narrower, class-typed other for
documentation purposes.
Examples
1 =:= 1 // => true
1 =:= 1.0 // => false (strict — different types)
(Dictionary new) =:= #{} // => true
Test strict value inequality (negation of =:=).
Examples
1 =/= 1.0 // => true (strict — different types)
1 =/= 1 // => false
Return the class of the receiver.
Examples
42 class // => Integer
"hello" class // => String
Handle messages the receiver does not understand. Override for custom dispatch.
No declared return type (BT-2834 pattern, see Object>>fieldAt:): a
custom override can return any type, and callers chain further sends
on the result that a fixed -> Object would statically reject.
Examples
42 unknownMessage // => ERROR: does_not_understand
Send a message dynamically with an arguments list.
Sent to a class, the class method runs in the caller's process, exactly
as the same send written out would, for every selector that is not
process-bound (new, spawn, startLink, ...; ADR 0142, ADR 0153).
Examples
42 perform: #abs withArguments: #() // => 42
Send a message dynamically with an arguments list and explicit timeout.
The timeout (in milliseconds or #infinity) applies to the gen_server:call
when the receiver is an actor. For value types, timeout is ignored.
Examples
actor perform: #query withArguments: #(sql) timeout: 30000