
Was common lisp also considered instead of Chez Scheme when wanting to rewrite Racket in a dialect of Lisp?

Many people say that the Emacs core could be rewritten in CL instead of C, and it would be just as fast, so just wondering if that applies to racket too

IIRC, common lisp doesn’t support continuation, right?

Chez Scheme was chosen because Racket can build features on top of it efficiently

Scheme feels as a subset of Racket. This means that Racket programmers can understand the code at the Chez Scheme level with little effort. The more people that can work on the low-level the better. Also as Sorawee writes, Chez Scheme supports more of the low-level language constructs that Racket needs out of the box.

From Wikipedia article of Chez Scheme: “It uses an https://en.wikipedia.org/wiki/Incremental_compiler\|incremental native-code https://en.wikipedia.org/wiki/Compiler\|compiler to produce native <https://en.wikipedia.org/wiki/Binary_file|binary files> for the https://en.wikipedia.org/wiki/X86\|x86 (https://en.wikipedia.org/wiki/IA-32\|IA-32, https://en.wikipedia.org/wiki/X86-64\|x86-64), https://en.wikipedia.org/wiki/PowerPC\|PowerPC, and https://en.wikipedia.org/wiki/SPARC\|SPARC processor architectures.”, so I guess Chez Scheme is just written in assembly and no other high level language, just like C itself.

Could Racket have a similar native-code compiler?

Why rewrite in any high level language?

Maybe I am misunderstanding something. I’m just a curious undergraduate student who is working sort of with compilers, so I don’t know that much. I also really appreciate all the work the good people here are doing on Racket

I believe bootstrapping is used so the compilers are mostly written in the language itself: c compiler mostly written in c, scheme compiler mostly written in scheme, most compiler books cover this in a chapter but the Wikipedia page is probable a good start;

Nice! I had never heard of this. The curious question leading from this is: what prevents Racket from having a bootstrapping compiler?

If Scheme can have one, what makes Racket so fundamentally different that it can’t?

I’m pretty sure the chez scheme compiler used by racket cs is a bootstrapping compiler, though I suspect some parts are written in c rather than assembler, as processor manufacturers like intel and arm provide a c compiler rather than an assembler. (C has taken the place of assembler)

Maintaining a large C or assembler codebase is difficult, and people are less likely to want to help work on it. By building Racket on top of Chez Scheme, a lot of effort is saved because it’s much easier to work on a Scheme or Racket program. This also means that it’s easier for people outside of the core Racket team to contribute to the implementation.

Also, it would be a lot of work build Racket’s sophisticated runtime from scratch, so extending an existing runtime instead is much easier.

In general, it’s much easier to write a compiler in a high-level language because of the valuable abstraction tools. Low-level languages are preferable when you need a lot of control over performance or need to interact with the computer in a very specific way.

So for bootstrapping, isn’t it the case that Scheme’s compiler is written in Scheme? Doesn’t that make it easy for Scheme users to understand their own compiler?

Sorry if I am misunderstanding

Sorry, yes, since Chez Scheme is written in Chez Scheme, it’s easy to understand.

Just wondering if Racket was written in Racket (similar to Chez Scheme), if it would make our lives harder in some way.

Or if this isn’t possible

Just curious, I don’t mean to disregard everyone’s efforts here or anything

Again, I really appreciate everyone’s work

Most stuff in Racket is already written in Racket. E.g., the macro expander, libraries, etc.



Thanks! I will take a look. I’m not involved in building real languages, so I was just looking for more things explaining the design decisions of Racket. Thank you everyone

Idris 2 is also based on Chez Scheme. https://www.reddit.com/r/programming/comments/9pgpb9/idris_2_has_chez_scheme_based_backend/


Based on the date - BC or CS?

is he’s saying racket cs > cs ?

Yes. Based mostly on changes racket has made to chez

Idris 2-on-Racket-on-Chez :stuck_out_tongue_winking_eye:

That tweet was the day after he gave the keynote at the Scheme Workshop at ICFP and talked about using Chez as a backend. https://www.youtube.com/watch?v=h9YAOaBWuIk

When I change the following two definitions. Performance varies. Why is using define-inline
much worse than define-syntax-rule
? I thought they are functional equivalent in some sense. (define (ptr++ ptr) (add1 ptr))
(define (ptr-- ptr) (sub1 ptr))
4.3s (define-syntax-rule (ptr++ ptr) (add1 ptr))
(define-syntax-rule (ptr-- ptr) (sub1 ptr))
3.8s (define-inline (ptr++ ptr) (add1 ptr))
(define-inline (ptr-- ptr) (sub1 ptr))
8.5s

in-value
accepts a single value, is there some variant which accepts multi-values?