ta0kira / zeolite

Zeolite is a statically-typed, general-purpose programming language.
Apache License 2.0
18 stars 0 forks source link

Add `FromBool` (etc.) `@type interface`s. #134

Closed ta0kira closed 3 years ago

ta0kira commented 3 years ago

This would have been ugly before the addition of #self. The implementations for built-in types can just delegate to bool.toInt(), etc.

ta0kira commented 3 years ago

Actually, this would just add to the dependencies required when linking binaries that use built-in types, so I'm going to hold off on this for now.

ta0kira commented 3 years ago

FromInt could still be useful for creating sequences of values.

For example:

@type range<#x>
  #x requires AsInt
  #x defines FromInt
(#x,#x) -> (Order<#x>)

// ...

traverse (range<?>('a','z') -> Char c) {
  // ...
}