Live data from Hacker News

The Scopes Programming Language

scopes.rocks

11–20 of 32 posts

Re: The Scopes Programming Language

#12
post #11

Tutorial and examples: http://scopes.readthedocs.io/en/latest/tutorial.html

The "unconst" business is... original, but it seems backwards to me. If I understand correctly, applying the Fibonacci function to a constant will compile a new version of the function, with the loop fully unrolled. And to avoid this, you have to mark some variable that is not the function argument but is initialized to a constant as "unconst". That just seems like a bizzarre source of confusion.

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.

Re: The Scopes Programming Language

#13
post #10
post #5

So this is a Scheme with pythonic syntax?

It doesn't seem to be very close to scheme. It's statically typed, AOT compiled, not garbage collected, and has C-ish semantics.

It has a REPL, supports S-expressions as a special case of the syntax, has garbage collection[1] and doesn't appear to have more C-ish semantics than Scheme already has.

[1] https://github.com/duangle/scopes/commit/13255e0ae7ab76e070c...

Re: The Scopes Programming Language

#15
From the intro: http://scopes.readthedocs.io/en/latest/about.html

> 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?

Re: The Scopes Programming Language

#16
post #13
post #10

Earlier quoted context omitted.

It doesn't seem to be very close to scheme. It's statically typed, AOT compiled, not garbage collected, and has C-ish semantics.

It has a REPL, supports S-expressions as a special case of the syntax, has garbage collection[1] and doesn't appear to have more C-ish semantics than Scheme already has. [1] https://github.com/duangle/scopes/commit/13255e0ae7ab76e070c...

That code does indeed automatically delete some entries from some collection, and it does use garbage collection terminology, but it doesn't appear to be full garbage collection for the whole language. Hard to tell in the complete absence of comments and a commit message.

But http://scopes.readthedocs.io/en/latest/about.html says "The memory model is compatible to C/C++ and utilizes simple unmanaged stack and heap memory." And I do recall paniq tweeting about wanting to implement a Rust-like system for memory management, because how hard can it be? (Fortunately, it doesn't look like he ever tried it.)

In addition, https://bitbucket.org/duangle/scopes/wiki/Home contrasts "expressivity of Scheme" and "the performance and runtime model of C" as if the developer did think of these as opposites.

Re: The Scopes Programming Language

#17
post #11

Tutorial and examples: http://scopes.readthedocs.io/en/latest/tutorial.html

The "unconst" business is... original, but it seems backwards to me. If I understand correctly, applying the Fibonacci function to a constant will compile a new version of the function, with the loop fully unrolled. And to avoid this, you have to mark some variable that is not the function argument but is initialized to a constant as "unconst". That just seems like a bizzarre source of confusion. I'm all for aggressi…

Regarding "unconst", we need to have a discussion. There are ways to make it implicit, namely by tying the return continuation of `if` to the constness of the conditional, but then one loses the ability to specialize the return continuation for constant results.

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.

Re: The Scopes Programming Language

#18

Hey paniq, based on your username I'm guessing that you are the same paniq mentioned on the duangle website and thus the creator of this intriguing little language! Scopes has certainly caught my interest in the short time I've looked at it this evening, but the documentation seems a bit sparse at the moment. I do have your screencasts queued up on YouTube and the repository cloned and ready to build, but if you have…

Hi, glad to hear you like it. I'm using Scopes to build a game engine called Tukan, which is for an ambitious game called Nowhere that is in development hell for four years. :-) I don't really know what I want from the community to be honest. I guess I just want to collect first impressions, see what people like, what they struggle with, what things they need and what ideas they come up with.

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.

Re: The Scopes Programming Language

#19

Is there support for effects or is there something like a concurrency monad ?

I don't know what those are, but Scopes is designed to make it easy for users to implement their own meta-programming abstractions. It might be possible to build such mechanisms from within the language. I certainly want to hear of the instances where it is not.

Re: The Scopes Programming Language

#20
post #13
post #10

Earlier quoted context omitted.

It doesn't seem to be very close to scheme. It's statically typed, AOT compiled, not garbage collected, and has C-ish semantics.

It has a REPL, supports S-expressions as a special case of the syntax, has garbage collection[1] and doesn't appear to have more C-ish semantics than Scheme already has. [1] https://github.com/duangle/scopes/commit/13255e0ae7ab76e070c...

S-expressions are not a special case of the syntax, S-expressions are the syntax. There are two notations, one is naked, python-looking, and one is traditionally braced, lispy-looking. It is possible to enter from one notation into the other at any point, depending on what suits the situation best.

Scopes has no garbage collection. There will be garbage collection for compile time symbols at some point, but the runtime is completely manually managed. That is a big difference to Scheme, although Scheme has been a major influence to Scopes design, and features that I believe to set Lisp/Scheme apart from other languages have been adopted.

Scopes is statically typed, but type signatures are not elementary to function definitions and value declarations, as with Scheme. It is a little limited with its compile-time closures though, whose application as first class values is limited.

Post reply on HN