Stream: t-compiler/wg-rls-2.0

Topic: patterns in rust analyzer


Coenen Benjamin (Apr 15 2020 at 14:21, on Zulip):

Hi folks ! I have a question about the ids used in ra. For example FunctionId, FileId, ... Is it coming from the entity component system pattern ?

Laurențiu Nicola (Apr 15 2020 at 14:24, on Zulip):

I think it's similar. matklad probably didn't arrive at that design from the game engine perspective, but rather from arena allocators, which are often used to reduce the performance impact of dynamic allocations.

Coenen Benjamin (Apr 15 2020 at 14:30, on Zulip):

Ok thank you @Laurențiu Nicola :D Another question haha, is the "interning" pattern also used in ra ? If yes, for which use cases ? With what is called the green nodes ?

Laurențiu Nicola (Apr 15 2020 at 14:35, on Zulip):

Green nodes are one place (see also the comment in https://github.com/rust-analyzer/rowan/blob/master/src/green/builder.rs#L15). Not sure about others. I think it also shows up in the salsa integration and with chalk (but there we don't really intern anything)

Laurențiu Nicola (Apr 15 2020 at 14:39, on Zulip):

(there's a bit of overlap between ECS, arenas, interning and "data-oriented design", so.. yeah)

Coenen Benjamin (Apr 15 2020 at 14:40, on Zulip):

Great, thank you. I have to figure out how green nodes and deduplication are made. I don't fully understand all these parts. Thanks for your help and giving me some insights.

Laurențiu Nicola (Apr 15 2020 at 14:57, on Zulip):

No worries. I'm not terribly familiar with the code myself so I can't tell you much more.

Last update: May 29 2020 at 18:00UTC