sapphire-lang 0.8.0

Gradually typed scripting language where every value is an object and types are optional, checked at runtime
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Point {
  attr x: Float
  attr y: Float

  def distance_to(other: Point) -> Float {
    dx = self.x - other.x
    dy = self.y - other.y
    ((dx * dx) + (dy * dy)).sqrt
  }

  def translate(dx: Float, dy: Float) -> Point {
    Point.new(x: self.x + dx, y: self.y + dy)
  }

  def to_s -> String {
    "(#{self.x}, #{self.y})"
  }
}