On Wednesday, 10 June 2015 at 16:03:17 UTC, Andrei Alexandrescu wrote:
On 6/10/15 8:41 AM, Brian Rogoff wrote:
I agree with you, Walter, that mutual recursion amongst imports is usually bad, but I think you inadvertently made the right decision by allowing it in D, and that the bug should be fixed. If people overuse it to write messy code then the community should tell them to write that
code better.

I agree. I'm one of those folks who think circular dependencies are fine, thank you very much, and the few cases in which it causes problems should be flagged and diagnosed in a principled way.

Everybody also likes:

* recursion and mutual recursion of any depth (there's a lot more of it going in the usual programs than one might think)

* recursive and mutually recursive types

* declaring top level names in any order and they just "work"

But all of a sudden, people get sugar in their gasoline and sand in their gears when they hear of the same thing applied to modules. I suspect it's because some legacy languages didn't quite do a stellar job at it. Figuring that stuff out and pointing out problems is exactly the kind of thing computers are good at and humans, not so good.


Andrei

Cyclic imports create problems that do not exists with forward declaration. This is surprisingly hard to get a well defined behavior for compile time feature. I would argue to make them illegal, but that is still a good idea to avoid them when possible.

Reply via email to