Skip to content

How should I handle recursive records when driving the Rust API? #2333

@twitchyliquid64

Description

@twitchyliquid64

Consider this nickel:

let rec
  b1 = {
    name = "build 1",
    inputs = [b2],
  },
  b2 = {
    name = "build 2",
    inputs = [b1],
  },

in
b1

Note that b1 is listed as b2's input, and vice-versa, making this recursive.

I get into an infinite loop with growing memory as soon as I build a Program out of this and call eval_full_for_export(). This makes sense, given that method is for exporting to JSON or whatever.

My question is, how can I eval the RichTerm tree in a manner that doesn't explode when there are recursive definitions, and handle circular references like this myself?

Thanks,
Tom

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