phanthero
2020-12-6 11:18:52

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


phanthero
2020-12-6 11:19:24

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


sorawee
2020-12-6 11:20:32

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


sorawee
2020-12-6 11:21:32

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


soegaard2
2020-12-6 11:24:42

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.


phanthero
2020-12-6 11:31:23

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-32https://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.


phanthero
2020-12-6 11:31:36

Could Racket have a similar native-code compiler?


phanthero
2020-12-6 11:31:42

Why rewrite in any high level language?


phanthero
2020-12-6 11:32:41

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


spdegabrielle
2020-12-6 11:38:08

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;

https://en.m.wikipedia.org/wiki/Bootstrapping_(compilers)\|https://en.m.wikipedia.org/wiki/Bootstrapping_(compilers)


phanthero
2020-12-6 11:40:36

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


phanthero
2020-12-6 11:41:34

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


spdegabrielle
2020-12-6 11:48:59

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)


kellysmith12.21
2020-12-6 11:54:28

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.


kellysmith12.21
2020-12-6 11:55:59

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


kellysmith12.21
2020-12-6 11:58:41

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.


phanthero
2020-12-6 12:29:34

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?


phanthero
2020-12-6 12:29:40

Sorry if I am misunderstanding


kellysmith12.21
2020-12-6 12:40:23

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


phanthero
2020-12-6 13:13:06

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


phanthero
2020-12-6 13:13:17

Or if this isn’t possible


phanthero
2020-12-6 13:13:31

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


phanthero
2020-12-6 13:13:42

Again, I really appreciate everyone’s work


sorawee
2020-12-6 13:14:04

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


sorawee
2020-12-6 13:16:05


phanthero
2020-12-6 13:21:00

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


wanpeebaw
2020-12-6 14:20:39


soegaard2
2020-12-6 17:20:50

Based on the date - BC or CS?


jestarray
2020-12-6 17:56:19

is he’s saying racket cs > cs ?


samth
2020-12-6 21:57:24

Yes. Based mostly on changes racket has made to chez


wanpeebaw
2020-12-7 00:39:36

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


plragde
2020-12-7 02:52:12

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


wanpeebaw
2020-12-7 03:53:15

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


yfangzhe
2020-12-7 07:48:00

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