Hacker News new | ask | show | jobs
by verdagon 53 days ago
Also, as I was writing this, a couple things occurred to me:

* We _could_ use the function parameter syntax `entities: &world.entities[]` instead of `entities in world.entities[]`.

* "Groups" aren't really central to understanding the idea, so Path Borrowing might be a better name than Group Borrowing.

Opinions welcome =)

5 comments

FWIW `foo in bar` implies iteration to me, not a path. In the .NET world, for example, `bar` would be a collection that we’re iterating through, assigning each element to `foo` in turn.
I had the idea to think about path checking as compile-time tracing GC. You have GC roots know by the compiler, and at any point in the code, you can perform liveness analysis, with roots on the stack, and every time a root goes out of scope, you do 'liveness analyisis' and deallocate everything that went out of scope.
Assuming “groups” are mainly about grouped invalidation, I agree, Path Borrowing is the better name, since it describes the core idea rather than the implementation mechanism.
A bit more fuel for the bikesheding aspect of this:

Subtree borrowing.

(Single ownership stemming from main is a tree of owners; each path specifies some subtree)

(Btw. I enjoyed reading it)

Love both.