https://github.com/watasuke102/settlang
A statically typed language that expresses mutability by whether variables have setters
https://github.com/watasuke102/settlang
programming-language rust webassembly
Last synced: 6 months ago
JSON representation
A statically typed language that expresses mutability by whether variables have setters
- Host: GitHub
- URL: https://github.com/watasuke102/settlang
- Owner: watasuke102
- License: mit
- Created: 2024-08-09T23:38:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-08T12:21:40.000Z (7 months ago)
- Last Synced: 2025-07-08T13:29:28.700Z (7 months ago)
- Topics: programming-language, rust, webassembly
- Language: Rust
- Homepage: https://watasuke102.github.io/settlang/
- Size: 581 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# 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)](https://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](https://opensource.org/license/mit/)) or MIT SUSHI-WARE LICENSE (`LICENSE-MIT_SUSHI.md`)