Language Design: Naming Conventions

Part 2: Conversion

Published on 2018-06-20.
Name Example Explanation
to

array.toList

int32Value.toFloat64

dictionary.to[Queue]

  • implies a (potentially lossy) conversion of a value
  • result type might use Option or Result types to encode failures
as

int64Value.asFloat64

int64Value.as[Float64]

stringBuffer.asByteBuffer

map.asSetOfEntries

setOfEntries.asMap

  • implies a verbatim reinterpretation/wrapping/viewing of a value
  • replacement for numeric "casts"