Bram Moolenaar's programming language, Zimbu
thenewstack.io
thenewstack.io
I hope I will be able to do something close to his achievements in my lifetime.
Hahahaha, this is what we needed: a programming language with unmatched braces because the opening brace can be inferred from context... Well, no surprise that this is coming from the Vim creator.
So it might look silly, but there is no deep reason it couldn't have just been
int main()
printf("hello");
}
That's just as unambiguous to parse. int foo(x)
int x;
{
return x;
}
and not in C23 (or GNU C) either, where this is legal (this example is not super useful): int foo(int x) [[gnu::aligned]] {
return x;
}That’s a mouth, not a paren :/ I won’t be able to sleep tonight :)) (that’s better
main(): int
printf "hello"
0
;) let main () =
printf "hello"
0OK, I'll stop now, but the point is: matching braces provide visual structure that's helpful to read code, even if it's syntactically redundant.
One is designed for machines to parse unambiguously, the other has grown organically and chaotically over hundreds of years. Machine parsing has never been a design concern.
Oberon:
IF a < b THEN
...
END
Pascal: IF a < b THEN
BEGIN
...
END while i > size
result += a [i++]
}
Could be correct, but "while i < size" seems more likely... int main()
printf("hello");
}
This is perfectly reasonable and has precedent in one of Wirth's languages (modular 3? Oberon?): /* Syntax from memory, may be wrong */
function main(): integer
println("hello");
end;
This does potentially break a symmetry in the language as to how a begin…End / {...} local block can be declared, but whatever, that's easily fixed.I don't see how this would make any particular issue for bracket matching (except one of the brackets isn't there, you match to something else such as the start of the function) and lexing/parsing is fast.
Just as a suggestion buy if everybody here actually write their own compiler, even a simple one, perhaps there would be less bikeshedding.
"For more flexibility, at the cost of performance and causing mistakes to be discovered only when the program is being executed, the dyn type can be used. A variable of this type can contain any kind of value or reference. Assignment to a dyn variable never fails. However, using the variable where a specific type is expected will invoke a runtime type check. For this purpose the dyn type stores information about the actual type."
Original comment below for posterity.
----
The article claims that Zimbu has "both static and dynamic typing", which sounds novel and interesting to me. But on the Zimbu site linked by a sibling, all I could find (on https://web.archive.org/web/20230529230025/http://www.zimbu....) was:
> It should work to have as much static type checking as possible, but make it possible to have dynamic types with runtime type checking.
Can anyone find any more details about this feature? (Or does it just mean "there's a type `obj` which is a supertype of every type", which is much less interesting except insofar as it interacts with what it means for something to be a reference vs value type?) The spec at https://web.archive.org/web/20230805135331/https://www.moole... is awfully long.
https://wphomes.soic.indiana.edu/jsiek/
Essentials of Compilation, both versions have a chapter on gradual typing.