Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why does this need to rely on `static` variables in the implementation? Can we use QCell-like lifetime branding tricks to have multiple independent GC-reference graphs that are assured at compile time to always be disjoint, and might undergo collection by separate threads?


Branded lifetimes are painful in practice as they infect _everything_ and often make it impossible to interop with other things.

I don't think you'd find a GC library to be useful to most developers if it required that. For those who might need it, it can be useful but for everyone else you're just paying for unnecessary pain.


This relies on static because the mutation buffer could have types last for the lifetime of the program (imagine if the collector never runs). I am unfamiliar with what you are describing so I cannot answer your second question.


Sorry for hijacking the thread, but: I was having a look at scheme-rs and read in the readme that you support syntax-case. This somewhat surprised me as the lower level macro facilities are the ugly underbelly of otherwise straightforward coding. More than once I have seen people skip syntax-case entirely and just go for er/ir-renaming macros instead.

I found the syntax-rules implementation but didn't really see any part of syntax-case. Did you mean you support syntax-transformers in general (together with what looks like a very nice syntax-rules implementation), and not syntax-case in particular?


Ah, I meant syntax rules, but syntax case is supported - there’s just no way to create syntax objects so it’s practically not useful.

My email is on my website, if you have any other questions feel free to shoot me an email.


Wait, never mind, I did implement syntax objects. So yes, there is syntax case. There are couple of limitations but it mostly works


I could't see any datum->syntax or syntax->datum anywhere.

If you have it, you know you can just implement syntax-rules in syntax-case? I do believe that is how chez, guile and racket does it.


Those two functions are indeed missing. However, you can create syntax objects with `syntax-quote`. Again, lots of missing functionality. They shouldn't be hard to implement tho, I just need to add template ids to the transformer.

If you're wondering how the hygiene works, each Identifier besides its name includes a set of "marks" (random unsigned integers). Identifiers are only equal if each name and their marks are equal. There's quite a bit more to this, but I feel you may be aware of how this works.

I do know. I haven't done that yet for no real practical reason besides some vestigial code that I have yet to remove. They are basically implemented the same already, under the hood they are both just transformers, I just haven't removed the AST code for syntax rules.


"Types lasting for the lifetime of the program" is accounted for by 'static lifetime. I am referring to the use of _static_ and _static mut_ declarations in the code, which is not quite the same thing. The interesting question is whether it might be possible to have multiple "collection" threads within a single instance of the program, each working on independent graphs.


Sorry, I misread your question. I’m sure it’s possible but this seemed like a good enough implementation for what I needed.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: