Erlang

Inherits from ProtoObject
Sealed

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

doesNotUnderstand: selector args: arguments source

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

== other

Test value equality (Erlang ==).

Examples

42 == 42           // => true
"abc" == "abc"     // => true
/= other

Test value inequality (negation of ==).

Examples

1 /= 2             // => true
42 /= 42           // => false
class

Return the class of the receiver.

Examples

42 class            // => Integer
"hello" class       // => String
doesNotUnderstand: selector args: arguments

Handle messages the receiver does not understand. Override for custom dispatch.

Examples

42 unknownMessage   // => ERROR: does_not_understand
perform: selector withArguments: arguments

Send a message dynamically with an arguments list.

Examples

42 perform: #abs withArguments: #()   // => 42
performLocally: selector withArguments: arguments

Execute a class method in the caller's process, bypassing gen_server dispatch.

The caller takes responsibility for knowing the method does not mutate class state. Useful for long-running class methods that would otherwise block the class object's gen_server.

Limitations: only resolves methods defined directly on the target class module (does not walk the superclass chain). Class variables and self are not available to the method (nil and #{} are passed).

Examples

MyClass performLocally: #run:ctx: withArguments: #(input, ctx)
perform: selector withArguments: arguments timeout: timeoutMs

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