← index

KeyValuePair

inherits Object

One key/value entry — what a Map yields when iterated: each: hands its block a KeyValuePair per entry, read with key and value. Build one directly with KeyValuePair.new:{ var key = …; var value = … }.

extended at core/16-serialize.qn:66

A Map entry, as #{'key': …, 'value': …} — the values recurse through the protocol themselves.

Class methods

new:

A pair from a config block that sets key and value variables; either one left unset reads as nil.

KeyValuePair.new:{ var key = 'a'; var value = 1 }     "* -> a:1

native

Instance methods

==:

True when the other value is a KeyValuePair whose key and value are both == to this pair's; anything else answers false.

native

asData

core/16-serialize.qn:67

key

The key half of the pair.

(KeyValuePair.new:{ var key = 'a'; var value = 1 }).key     "* -> a

native

s

The display string key:value, each half through its own .s.

(KeyValuePair.new:{ var key = 'a'; var value = 1 }).s     "* -> a:1

native

value

The value half of the pair.

(KeyValuePair.new:{ var key = 'a'; var value = 1 }).value     "* -> 1

native