News for hackers. Stuff that matters.
Re:Cyclic dependencies are evil (2013) by brundolf on Saturday January 30, 2021 @03:17PM (#25972560)
I think the OP is overly dogmatic and I agree with you that sometimes you just need circular dependencies

That said, I don't see what circular dependencies have to do with reflection, much less a functional style? For a trivial example, Rust lacks reflection but the following (functional-ish) code works just fine:

    mod ModA {
        use crate::ModB::B;
    
        pub struct A {
            ref_to_b: Option<Box<B>>
        }
        
        pub fn into_b(a: A) -> Option<Box<B>> { a.ref_to_b }
    }
    
    mod ModB {
        use crate::ModA::A;
    
        pub struct B {
            ref_to_a: Option<Box<A>>
        }
        
        pub fn into_a(b: B) -> Option<Box<A>> { b.ref_to_a }
    }
Am I missing something?
Re:Cyclic dependencies are evil (2013) by Smaug123 on Saturday January 30, 2021 @03:22PM (#25972602)
Could you give an example of a domain that naturally requires circular dependencies? I have been trying lately to practice seeing outside the functional-programming-tinted lenses, but I need a bit of help to do so :)
Re:Cyclic dependencies are evil (2013) by brundolf on Saturday January 30, 2021 @03:27PM (#25972652)
I think the GP's example is pretty reasonable. And like I said, I still don't really see what this has to do with FP. Clearly F# has trouble with it, but so does C++
Re:Cyclic dependencies are evil (2013) by Smaug123 on Saturday January 30, 2021 @03:52PM (#25972874)
I don't think the GP's example is reasonable, and nor would an SQL-writer. Could you give something I will find it harder to wriggle out of?