mighty-gerbils / gerbil

Gerbil Scheme
https://cons.io
GNU Lesser General Public License v2.1
1.16k stars 111 forks source link

[Question] Does Gerbil has support for reader macro hooks? #692

Closed phantomcraft closed 1 year ago

phantomcraft commented 1 year ago

===> http://wiki.call-cc.org/man/4/Unit%20library#reader-extensions

phantomcraft commented 1 year ago

Chicken has the following hooks for macro readers:

set-read-syntax!
set-sharp-read-syntax!
set-parameterized-read-syntax!
copy-read-table

In case Gerbil doesn't have implemented such hooks, is it possible to implement them?

The implementation of this features are here.

vyzo commented 1 year ago

This is slightly more complicated, but we do have full per module custom reader and expansion support -- see "Custom Languages" in the tutorial.

So it is possible to complrtely change the surface syntax on per module basis.

phantomcraft commented 1 year ago

@vyzo

we do have full per module custom reader and expansion support

Awesome, looking at Wikipedia article about metaprogramming, Gerbil has a macro system, metaclasses and template metaprogramming.

I was thinking before in choosing Gerbil as my scripting/toy language, but looking all these features now I'm thinking on putting it on a higher level.

Just another question, is it possible to disable the garbage collector and manage the memory manually? If it's possible, should I use FFI and use malloc() function from C's libc. I'm asking this because I want to code for maximum performance.

vyzo commented 1 year ago

It is not possible to disable the gc, but in general it is quite efficient and it is possible to allicate objects as still or immovable or even do full manual alloc with the ffi. It is not simple however.

phantomcraft commented 1 year ago

Thanks.

phantomcraft commented 1 year ago

Chicken has some facilities for managing the memory manually.

It would be interesting to have something like this in Gerbil, dealing with low-level stuff would be easier.

vyzo commented 1 year ago

yes, indeed.

phantomcraft commented 1 year ago

Could you please implement one day?

vyzo commented 1 year ago

Yes, I'd like to have them too, but I can't commit to a specific date :)

vyzo commented 1 year ago

(busy with work an all that)

phantomcraft commented 1 year ago

I came across Gerbil by this article: https://news.ycombinator.com/item?id=15394603

Chicken and Racket sucks because they are slow despite their great standard library and extensions, seeing Gambit/Gerbil benchmarks against Chicken made me give it up completely, and for Racket, it can't produce binaries for all the platforms. With Gerbil I can emit an universal C code and compile to run anywhere.

Gerbil is really the best Scheme implementation.

phantomcraft commented 1 year ago

@vyzo

Yes, I'd like to have them too, but I can't commit to a specific date :)

(busy with work an all that)

Managing memory at a low-level would be very welcome, good luck in implementing it.

I'm looking forward for that.

phantomcraft commented 1 year ago

@vyzo

I don't want to pressure you, but I would appreciate if you could keep us informed of your progress.

I really don't want to go Chicken Scheme because it's too slow compared to GambitC/Gerbil.

vyzo commented 1 year ago

Hey,

I cant make guarantees about when i will have time to work on such things, i am really busy with work.

I will review any incoming pr implementing such things promptly however, and tend to it with high priority.

phantomcraft commented 1 year ago

Ok, I understand, good luck with your work.

belmarca commented 1 year ago

@phantomcraft What exactly are you trying to do?