samth
2018-11-24 12:15:02

@pocmatos you might be interested in https://github.com/rjnw/sham


andreiformiga
2018-11-24 14:37:27

LLVM is usually considered a bad fit if your language is not close to C/C++


pocmatos
2018-11-24 17:49:11

@samth @mflatt Is there a way to get C objects in a shared library to use the Racket GC?


mflatt
2018-11-24 17:52:58

Use the Racket CS in what way? Register roots that the GC will traverse and update?


pocmatos
2018-11-24 18:14:46

So, I was thinking about getting a project going whereby a #lang implementing a small subset of racket compiles down to C, and exports all the defined function using the ffi so that they are provided to those requiring modules written in such lang. I would of course need a GC in such a C translation so I was wondering if I can hijack the Racket GC to use in the translated code. In the end this compiled C code will always run under a Racket process, therefore there’s already a GC running.


mflatt
2018-11-24 18:26:53

For the traditional Racket implementation, yes: The GC API is generally exported by Racket. For example, there’s racket_malloc, and there are macros like MZ_GC_DECL_REG to temporarily register roots (such as references in stack-allocated memory). For Racket-on-Chez, not so much.


contact
2018-11-24 19:28:00

Is there a nice way to modify a module, reload it in the repl and test some functions in the repl? I have this weird and inconvenient thing to execute so far: (dynamic-rerequire "utils.rkt") (require "utils.rkt") (dynamic-rerequire "tokenizer.rkt") (require "tokenizer.rkt") (dynamic-rerequire "parser.rkt") (require "parser.rkt") (dynamic-rerequire "interpreter.rkt") (require "interpreter.rkt")

each time I modify a module somewhere. It would be nice if the modules where reloaded automatically so that we only have the latest version of the code loaded in the repl


contact
2018-11-24 19:28:09

Is it possible to do it somehow?


contact
2018-11-24 19:39:44

Well, apparently, (require racket/rerequire) (require racket/enter) (enter! "some_module.rkt") does the job!


macocio
2018-11-24 19:51:39

@contact I wonder if the module reloadable works in the REPL


contact
2018-11-24 19:53:40

@macocio Well, so far, by typing (enter! "module.rkt") it reloads the code that’s enough for me!


macocio
2018-11-24 19:54:18

@contact Ok, reloadable reloads it automatically when the file is saved.


pocmatos
2018-11-24 20:17:29

That’s a shame since if the future is Racket-on-Chez, I would like to plan for that.


pocmatos
2018-11-24 20:18:17

Is the Chez GC a precise GC as well? I assume it’s a completely different implementation of standard Racket.


mflatt
2018-11-25 01:12:03

Yes, Chez Scheme’s GC is precise. It’s more tightly bound to Scheme object representations than Racket’s GC. You can call Chez Scheme functions from C https://cisco.github.io/ChezScheme/csug9.5/foreign.html#./foreign:h8 and depending on what you want to do, that may work fine. Roughly, a GC will not happen while you’re in C code. Racket’s GC can fire on any allocation, while Chez Scheme’s GC fires through an asynchronous callback only while running Scheme code.