Skip to content

A statically typed language that expresses mutability by whether variables have setters

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE-MIT
Unknown
LICENSE-MIT_SUSHI.md
Notifications You must be signed in to change notification settings

watasuke102/settlang

Repository files navigation

Settlang

Settlang is a statically typed programming language that expresses mutability by whether variables have setters.

Let's try!

Visit Playground (watasuke102.github.io/settlang) to try on the playground!

Example

See /examples for more.

#*
  Settlang minimal example
*#
fn accumulator(self: i64, e: i64) -> i64 {
  # just return added value
  ret self + e
}

fn randomize() -> i64 {
  ret random(0, 100)
}

# function named `main` is entrypoint
fn main() -> i64 {
  # they have 'setter' function, so mutable
  let sum: i64 | accumulator = 0
  let rnd: i64 | randomize   = 0

  for i in 0..10 {
    rnd.set()         # call setter of rnd
    print("{}", rnd)  # print value
    if i != 9 {
      print(", ")
    }
    sum.set(sum, rnd) # call setter of sum
  }
  println("")

  ret sum
}

LICENSE

Dual-licensed; MIT (LICENSE-MIT or The MIT License – Open Source Initiative) or MIT SUSHI-WARE LICENSE (LICENSE-MIT_SUSHI.md)

About

A statically typed language that expresses mutability by whether variables have setters

Topics

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE-MIT
Unknown
LICENSE-MIT_SUSHI.md

Stars

Watchers

Forks

Releases

No releases published