sekiguchi-nagisa / arsh

A statically typed scripting language with shell-like features
Apache License 2.0
21 stars 2 forks source link

immutable type #541

Open sekiguchi-nagisa opened 2 years ago

sekiguchi-nagisa commented 2 years ago

user-defined types only contain read-only, immutable fields are treated as immutable type. immutable type is used in map key, sort method, indexOf method.

typedef Interval($b : Int, $e : Int) {
  let begin = $b
  let end = $e
}

var map = [new Interval(0,2) : 2]
[new Interval(0,1), new Interval(2,3), new Interval(-1,9)].sort()

also implicitly define relative operators such as <, <=, >, >=, ==, !=

sekiguchi-nagisa commented 2 years ago

need to change the following internal api

also need to re-implement internal hash map due to error propagation of internal equals api related to #409