I'm all for aggressive user-controlled loop unrolling and partial evaluation, but it should be user-controlled, not "I'll just always do it behind your back and sometimes surprise you with an obscure error message that requires a non-obvious fix and will make your function non-optimizable even in cases where you would want to request it".
Also, yay for named loops, but the syntax is weird. To me,
let foo ... = ...
if (bar)
...
Doesn't look like one loop but two unrelated statements. I understand that it's the underlying label/goto abstraction leaking through, but that looks like a backwards jump (haha) in time.Named `let` is the most primitive form of loop, suitable for use in runtime and compile time (constexpr-style) context. There are more convenient, less versatile and compiler-friendly versions like `for ... in` and `while`. It is possible to design your own loop structures, and even build an auto-unconsting `if`, so I was hoping that the community would innovate here within the language.
Partial evaluation is user-controlled. The rules are deterministic: the system guarantees that constant expressions are always folded. The error message would not exist if we could solve the halting problem. There is no way to tell in every instance if a loop or recursion ever terminates, so I went for the simplest rule, which is that if a label is reentered the 32th time, we abort compilation. It's a cautious limit because constant folding is interpretation (slow), and I don't think that programmers want big loops to unroll. This can and should be discussed. I certainly don't have all the answers.
> I understand that it's the underlying label/goto abstraction leaking through
Scopes' abstractions aren't leaking, they are offering their innards to you. You can generate and inspect IL from within the language. Everything has been made so that you can build your own abstractions on top of them, which is only possible when the internals aren't hidden. The philosophy is that a compiler is a servant, not a framework.
> the compiler is designed to remain on-line at runtime so that functions can be recompiled when the need arises, and generated machine code can adapt to the instruction set present on the target machine. This also diminishes the need for a build system
Diminishing the need for a build system is nice! Any other language with such philosophy in mind?
Many Lisp systems also have their native code compiler on-line.
[1]: http://www.paulgraham.com/diff.html "The whole language always available"
[1] https://bitbucket.org/duangle/scopes/commits/ca7126d88bbd [2] https://bitbucket.org/duangle/scopes/src/1bf171c25f4047bc049...
I do think that Scopes is uniquely suited for monolithic multimedia applications like games and media authoring and that would be the direction I'd like to see it go. But there's technically no reason why it couldn't go another way.
Anyway, the type of the print "hello world" expression would explain a lot.
[1] https://github.com/duangle/scopes/commit/13255e0ae7ab76e070c...