API
The selectors of every type come from one table inside the compiler. That table is the only place that says what can be sent. The full listing — what lpsc api prints — ships with the distribution. This page is the overview.
Numbers and money
| type | the main selectors |
|---|---|
Int | + - * // \\ < abs max: min: between:and: asDecimal asFloat asString to: to:collect: timesRepeat: |
Float | the same arithmetic, plus sqrt floor ceiling rounded asInteger |
Decimal | + - * / and the comparisons. Rounding names its direction — roundedTo: truncatedTo: floorTo: ceilingTo: awayFromZeroTo:. Division is dividedBy:roundedTo: and friends, saying how much to keep. Display is grouped and groupedTo: |
Int is a BigInt; digits do not fall off. Decimal's / refuses when the result is not exact, so an inexact division is written as dividedBy:...To:.
Text
| type | the main selectors |
|---|---|
Str | , size at: copyFrom:to: splitOn: replaceAll:with: startsWith: endsWith: includesSubstring: indexOf: asUppercase asLowercase reversed trimmed asInteger asDecimal asDate asSymbol collect: do: |
Char | value |
Symbol | name |
Bool | and: or: not ifTrue:ifFalse: |
asInteger, asDecimal and asDate answer a Maybe. Text that does not parse is a none, not an exception.
Collections
| type | the main selectors |
|---|---|
Array[a] | size isEmpty first last at: at:ifAbsent: do: doWithIndex: collect: select: reject: detect:ifNone: inject:into: includes: indexOf: copyWith: take: drop: reversed sorted sortBy: joinWith: allSatisfy: anySatisfy: , |
Dict[k v] | at: at:ifAbsent: at:put: removeKey: includesKey: keys values size collect: select: do: |
Assoc[k v] | key value |
Maybe[a] | isPresent isAbsent value orElse: map: ifPresent: ifPresent:ifAbsent: |
Both are values: at:put: answers a new Dict and leaves the old one alone. sorted is available where the elements answer <; anything else gives the order to sortBy:.
Dates
| type | the main selectors |
|---|---|
Date | year month day dayOfWeek dayOfYear plusDays: minusDays: plusMonths: plusYears: startOfMonth endOfMonth daysUntil: isLeapYear slashed, and the comparisons |
Instant | comparisons, asString, and conversion to a Date with a named zone |
A Date has no time and no zone. plusMonths: is civil: a month after the 31st is the end of the next month.
JSON and HTTP
| type | the main selectors |
|---|---|
Json | at: itemAt: keys size isNull asStr asInt asDecimal asFloat asBool asArray asText |
Json (class side) | parse: object: array: str: int: decimal: bool: null |
Http | get: get:headers: post:json: post:text: put:json: delete: url:query: encode: deadline: |
Response | status body ok header: |
at: never throws: sent to something that is not an object it answers the null Json, so a path can be walked without checking each step. The leaves — asInt and the rest — answer a Maybe. An Http request cannot fail either: a connection that never came back answers as a Response with status 0.
Views
| type | the main selectors |
|---|---|
Html | clone: clone:fill: el: el:text: el:attrs: el:kids: el:attrs:kids: text: markup: child: child:as: all: |
VNode | at:put: at:kids: at:class: at:attr:is: on:send: on:sendValue: on:sendEvent: at:on:send: key: class: attr:is: preventDefault stopPropagation |
Event | kind value checked key x y scrollTop height shift ctrl alt meta |
App | mount: mount:at: page: path go: replace: html: htmlAt: |
App carries a second set for testing — click: type:text: press:key: check:is: focus: blur scrollTo: — which a screen never uses.
Actors
| type | the main selectors |
|---|---|
Actor (class side) | spawn: spawn:named:, and spawn:as: to type the reference by a protocol |
ActorRef[c] | tell and ask — what follows is a handler you declared — plus name and stop |
ActorCtx[c] (me) | ref name spawn: spawn:as: monitor: demonitor: link: stop stop: after:send: onPath: listen:on:send: listen:on:sendValue: listen:on:sendEvent: intercept:on:send: and the rest |
Down | actor reason |
Future[a] | forced then: onError: |
Future (class side) | value: all: after:do: sleep: |
Worker (class side) | new spawn:on: |
The rest
Console (printLine:), Math, Time, Sys, and Error (signal:).
Where the list comes from
These tables are printed from the compiler's own signature table. A selector that is not in it does not compile. Whether it exists is checked as well: a test reads the table and asks the runtime whether every selector the compiler promises is really there.