Re: Finishing SRFI 234 (Topological Sorting)
Lassi Kortela 01 Dec 2022 07:19 UTC
> I still think that signaling an error is wrong (and against the spirit
> of the R[67]RS exceptions). See here:
> https://srfi-email.schemers.org/srfi-234/msg/20488634/.
I'm sympathetic to both interpretations.
A cyclic dependency graph feels similar to a parse error. An interpreter
expects to parse a valid program; make expects an acyclic graph. In both
cases the user can mess up and provide invalid input.
A parser true to the functional style would probably return a ParseError
object instead of raising it. In the Go language, error objects are
returned all the time where most other languages would raise them.
As an aside, `make` would be capable of making targets that are not part
of a cycle. So giving up in case of a cyclic graph may block useful
functionality in some cases. However, this would require the SCC algorithm.
Threads like this show that SRFI may not be the right forum for this
procedure. After all, toposort can be implemented portably with
reasonable efficiency.