Live data from Hacker News

Gerbil – An opinionated dialect of Scheme designed for systems programming

github.com

51–60 of 80 posts

Re: Gerbil – An opinionated dialect of Scheme designed for systems programming

#51
post #8

Can anyone explain why there are so many implementations of Scheme written in Scheme? What is the point of doing that (apart from learning purposes)? I know, for example that people want Racket VM to be implemented in Chez Scheme because Chez is super fast. But what about all other implementations? Also, as I'm currently writing R5RS/Clojure hybrid in Kotlin, can anyone please share any _simple_ standard algorithm of…

The simplest way would probably be to implement explicit and implicit renaming macro transformers. They are found in many schemes and are quite a bit simpler than the syntax case you linked to. Then you can just glue parts of ashinn's match.scm on top of it for the pattern matching.

There is also a srfi for an improved hygiene low level macro facility that is rather elegant. Can't remember the number though. 70-something.

Re: Gerbil – An opinionated dialect of Scheme designed for systems programming

#52
post #8

Can anyone explain why there are so many implementations of Scheme written in Scheme? What is the point of doing that (apart from learning purposes)? I know, for example that people want Racket VM to be implemented in Chez Scheme because Chez is super fast. But what about all other implementations? Also, as I'm currently writing R5RS/Clojure hybrid in Kotlin, can anyone please share any _simple_ standard algorithm of…

HN uses * instead of Markdown's _ for emphasis.

Re: Gerbil – An opinionated dialect of Scheme designed for systems programming

#53
post #3

Why do people keep thinking they can use a garbage-collected language for “systems programming”?

I always wonder exactly what kind of "systems" these people are programming, clearly not any with real-time constraints. It almost seems like "systems programming" got co-opted to mean "not interpreted". At least that's what I noticed with Go's marketing. There are a few HFT firms, most notably Virtu, that use Java. But my understanding from having interviewed people that worked there is that it's so convoluted to av…

It seems to md that systems (with a 's') programming was a term lntroduced by Go, and I always understood it has something with a wider scope than system programming - actually "intermediate level" applications for which a GC is acceptable both time-wise and space-wise. Yet for system (without 's') programmers (kernel, driver or embedded systems devs for instance) a GC is still a no-go.

Re: Gerbil – An opinionated dialect of Scheme designed for systems programming

#54
post #46

Earlier quoted context omitted.

Yes, Chez & Stalin are the fastest in these benchmarks, which seems to match what the community usually answers when asked about quick implementations. Sadly Stalin is unmaintained. Its whole program optimization techniques were really advanced. I remember it even got my ivory-tower professors, who were big in the static analysis field, excited. Now, a tricky question. I'm mostly unfamiliar with Scheme for writing re…

R7RS ftw.

I feel that not standardising a low level FFI for r7rs large is a mistake. They should at least recommend some reasonably low level stuff that can be used to build abstractions.

Re: Gerbil – An opinionated dialect of Scheme designed for systems programming

#55
post #3

Why do people keep thinking they can use a garbage-collected language for “systems programming”?

I always wonder exactly what kind of "systems" these people are programming, clearly not any with real-time constraints. It almost seems like "systems programming" got co-opted to mean "not interpreted". At least that's what I noticed with Go's marketing. There are a few HFT firms, most notably Virtu, that use Java. But my understanding from having interviewed people that worked there is that it's so convoluted to av…

> I always wonder exactly what kind of "systems" these people are programming, clearly not any with real-time constraints.

Well Niklaus Wirth for one was able to design an entire OS using a language (Oberon) that had garbage collection.

> There are a few HFT firms, most notably Virtu, that use Java.

The hedge fund where I worked used Java. We didn't have problems with latency, although admittedly we weren't doing the really low-latency stuff. There are patterns that you can use in Java that basically emulate manual memory management. In Java this is a little harder than in C# because there no value types, but java.nio basically lets you do whatever you want, so you can always allocate everything up-front. In fact, just for fun I did this myself in an audio setting. So basically I had an audio engine with a ring buffer to pass messages to the event loop, and with a little care I was able to ensure that there literally no garbage that made it past the first phase (i.e. locals). Those are essentially free, so basically the GC wasn't getting any pressure at all. It wasn't that hard to write, and with the excellent profiling tools available on the JVM it's easy to see which if you're making use of longer-term GC sweeps or not.

Finally, I would add that there are scenarios where C++ moves into automatic memory management. std::shared_ptr is an example of (shitty) automatic memory management, but there have been efforts, notably by Herb Sutter, to provide precise GC-collection as a library. For some non-blocking multithreaded algorithms, GC schemes are actually necessary since allocation becomes one of the prime vectors through which blocking occurs.

So conclusion, while it's certainly the case that most systems programming is done in languages with manual memory management, it's a little less binary than you suggest. That said: I'm writing a DAW (zenaud.io) and for that I am using C++, mainly for memory management :)

Re: Gerbil – An opinionated dialect of Scheme designed for systems programming

#56

Earlier quoted context omitted.

>Why do people keep thinking they can use a garbage-collected language for “systems programming”? Why do you think it can't be done? It was already used for systems-programming in the early 80s; whole machines were programmed in Lisp in low level: TI Explorer, Xerox workstations and others.

I distinctly remember waiting quite a long while with my Symbolics locked up while it completed a GC.

GCs are better these days. And you're much more likely to wait on IO anyway, at every granularity level in the system.

Re: Gerbil – An opinionated dialect of Scheme designed for systems programming

#57
post #28

Earlier quoted context omitted.

I'm afraid I literally laughed out loud at your request for a simple standard algorithm for r5rs macro systems. However, it's a sympathetic laugh. Macro Hygiene is still very hard, principally because (I claim) there's not yet a clean and widely accepted model for it. Matthew Flatt's "sets of scopes" model is (IMNSHO) the current leader. Time will tell whether he or anyone else comes up with a simpler and more widely…

Yeah, you are right. I've already implemented everything from r5rs, but macro system. And I don't know where to start, just can't wrap my head around it. And people say that Scheme has a very minimalist design and is easy to implement...

You may find this paper helpful [1]. As noted there, syntax-rules consists really of two different parts: (1) the hygiene-preserving macro expander and (2) the pattern-matching facility. Once you wrap your head around the two pieces, it's actually pretty straightforward to implement them both. It's very common to write some "low-level" macro facility as a stepping-stone to syntax-rules (such as explicit-renaming macros or syntactic closures): the implementation of syntax-rules then becomes a composition of the pattern-matcher and the low-level facility. A tutorial implementation of an appropriate pattern-matcher can be found at [2],[3].

There's lots of good reading to be found at the ReadScheme Library [4]. Most if not all of the references in [1] can be found there.

Tangentially: yeah, syntax-rules kinda flies in the face of the oft-mentioned minimalism of Scheme, but there's a reason for it: at the time syntax-rules was standardized, there was no consensus on which (if any) low-level facility should be standardized (and, really, there still isn't any such consensus). The reason syntax-rules operates as a pattern-template rewriting system rather than as a procedural system is that such a system is able to guarantee that the macros it produces are hygienic in a (comparably) simple and intuitive way. The idea was to standardize on a high-level system so that Scheme could have a standard macro facility, whilst leaving the low-level systems open for further exploration and experimentation. The two main contenders are still, after all these years, syntax-case and syntactic closures: the latter being easier to implement and arguably easier to grok, the former being potentially more powerful (in that an implementation of syntactic closures within syntax-case is known, but not vice-versa (last I checked)).

--

[1]: http://mumble.net/~jar/pubs/scheme-of-things/easy-macros.pdf

[2]: http://blog.theincredibleholk.org/blog/2013/02/11/matching-p...

[3]: http://blog.theincredibleholk.org/blog/2013/02/12/patterns-w...

[4]: http://library.readscheme.org/

Re: Gerbil – An opinionated dialect of Scheme designed for systems programming

#58
post #46

https://ecraven.github.io/r7rs-benchmarks/ recent addition to the charts, and is doing quite well.

Yes, Chez & Stalin are the fastest in these benchmarks, which seems to match what the community usually answers when asked about quick implementations. Sadly Stalin is unmaintained. Its whole program optimization techniques were really advanced. I remember it even got my ivory-tower professors, who were big in the static analysis field, excited. Now, a tricky question. I'm mostly unfamiliar with Scheme for writing re…

> Will the ongoing merger of Chez with Racket make the latter a clear winner in the Scheme camp?

Academically they have all the super giants of Scheme. It is now within the past few years with the renaming to Racket that the success story is just now unfolding after over 20 years of development. I think Racket will end up being the clear leader not just of scheme but of Lisp. Reminds me of when R just took off 5 or 6 years ago.

Re: Gerbil – An opinionated dialect of Scheme designed for systems programming

#59
post #25
post #20

Here is some context on Racket vs Gerbil by a well-known Common-lisp Programmer, François-René Rideau : https://fare.livejournal.com/188429.html

Some excellent comments there. Looking around a bit, I came across a couple of implementations that might be of interest for those wanting to mash up "some kind of system programming" and "scheme": Bigloo (interpret / compile to executables, java byte code or experimentally dot.net) and larceny (interpret / direct compile to machine code / optionally via c): http://www-sop.inria.fr/mimosa/fp/Bigloo/ http://www.larcen…

Chicken Scheme

https://www.call-cc.org/

is another good one - compiles to binary, many libraries (eggs)

Re: Gerbil – An opinionated dialect of Scheme designed for systems programming

#60
post #8

Can anyone explain why there are so many implementations of Scheme written in Scheme? What is the point of doing that (apart from learning purposes)? I know, for example that people want Racket VM to be implemented in Chez Scheme because Chez is super fast. But what about all other implementations? Also, as I'm currently writing R5RS/Clojure hybrid in Kotlin, can anyone please share any _simple_ standard algorithm of…

A single unifying scheme standard?

You must be new here..

Post reply on HN