Skip to content

Graph-based data structures #886

Description

@OOTS

Hello,

a few days ago I read an article about Rue in a german IT magazine. Since I'm working on a programming language with similar design goals as a hobby project, I'm quite interested in Rue.

After having skimmed over the available documentation (tutorial and language spec) my understanding is that there are two different "kinds" of datatypes in Rue: "copy"-able types and "move" types. From what I've seen, borrowing is supported, but only for the duration of a function call.

While that is fine for an experimental language, I think this model is not sufficient to store graphs or graph-like data structures. E.g., if one wanted to implement a shortest-path algorithm such as Dijkstra's algorithm, one would first need an in-memory representation of the graph. One natural implementation is to create a struct Node which stores a list of outgoing (and maybe) incoming edges. If the struct Node would be @copy-able, one would have to change all copies of a given node if one wanted to add an edge. If the struct Node was not copy-able it wouldn't be possible to store multiple references to the same struct.
(There are other ways to represent a graph in memory, e.g. via incidence matrices, but ... they appear a bit unnatural to me.)

Another example would be (HTML-style) DOM trees, where each node not only stores references to it's children but also to it's parent. In fact, I think even implementing a doubly-linked list would not be possible within the current model.

I'd be curious to know/hear your thoughts about this limitation. Is it something you'd be willing to accept permanently? If not, do you have any plans to extend the model and allow references (in some way)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions