> In case you really need to vary a variable, the when keyword lets you check a variable each time it mutates.
const var health = 10!
when (health = 0) {
print("You lose")!
}
If it can really be triggered when the variable changes to any value it makes it a truly reactive paradigm programming language. By the way, could that be hacked to implement loops? const var i = 10
when (i >= 0) {
do_something()
i = i - 1
}Maybe Prolog is the perfect language.
functi fibonacci (n) => {
const var sum = 1!
const var i = 0!
when (i < n) {
sum += sum + previous sum!
i++!
}
}
when (i < 10) {
fibonacci(i)?
i++!
} var var i<10> = 0!!
var var i = false!
when (i) {
print(i)!
i++!
}
I think this should print 0,1,2 and then stop, assuming checking the condition is a line of code, and that lifetimes are for lines executed and not just the syntax.Side-effect is that it will delete all the whens, so only use it if you need it!
About coupling, an implementation could send state change events to a message bus and observers could subscribe only the events they care about.
> To declare a function, you can use any letters from the word function (as long as they're in order):
> function add (a, b) => a + b!
> func multiply (a, b) => a * b!
> fun subtract (a, b) => a - b!
> fn divide (a, b) => a / b!
> functi power (a, b) => a * b!
count func (a,b) => ...
in out (a,b) => ...
of if (a,b) => ...
Wonderful language, wonderful.Here are some of my favorites:
union
funi
funion
fution (sounds like fussion)
fu
fuc
fucton (as noted by a fellow commenter)
Infinite lifetime is actually useful here and there. I'll usually slap an infinite lifetime wrapper around the `requests` or `httpx` module when I'm testing out some Python web scraping code.
The only implemented language I know of with this feature is the obscure array lang I (an incrementation of the J language's name I assume) by Marshall Lochbaum:
I mean constant constants, constant variables, and variable variables seem useful.
I'm not sure how would variable constants be useful.
Also, anybody knows the difference between constant constant and immutable data (constant contact constant)?