6
MoonOwl
6y

I need cyclic data structures but algebraic data types are my first love and tying the knot is impossible with the eagerness F# has. The interfaces and classes I abandoned C# for are the ones I am now writing in F#. What a job well done on my part in avoiding mutability :(

Comments
  • 0
    Is it relatively easy to do this in F#? I imagine it's much easier than in Rust since the runtime has GC.
  • 0
    @beegC0de F# has garbage collection too
  • 0
    @MoonOwl that's what I meant* in Rust you explicitly add garbage collection to your types
  • 0
    @beegC0de F# is an ML. ML's are garbage collected by default like many other functional languages. But what does garbage collection have to do with the expression of cyclic graphs?
  • 1
    @MoonOwl cyclic references can lead to double frees when the value is dropped. This is avoided in garbage collected languages because the runtime knows when all references to a value are gone. Maybe you don't even have to think about it in f#, I just saw "algebraic data types" and "cyclic data structures" and thought HEY Rust has this and had problems representing those!
  • 0
    @beegC0de Ah I get you now. Sorry for misreading your comment. I remodelled the problem and solution
Add Comment