TomasMikula / libretto

Declarative concurrency and stream processing library for Scala
Mozilla Public License 2.0
199 stars 7 forks source link

Are the extensions in `ClosedLib` necessary? #84

Closed MateuszKowalewski closed 1 year ago

MateuszKowalewski commented 1 year ago

Currently the extensions on FocusedCo and FocusedContra aren't used (and form the last one only curry is used).

Is this by design?

If so this needs tests, I guess.

I could turn out that the DSL extensions actually don't even work after the change to extension methods from implicit classes. There is an issues with that in CoreLib. Could be the same here.

TomasMikula commented 1 year ago

The extensions are helpers for writing Libretto code in point-free style. It was ubiquitous before Libretto had lambdas. I was adding such helpers on a by-need basis (and sometimes for symmetry, like co-/contra-), so they likely had uses, which might have disappeared after some code was rewritten using λ.

Anyway, I would keep these extensions around. So it is appropriate to test them.

MateuszKowalewski commented 1 year ago

Exactly! If it's there on purpose it should have some usage side also.

If Scala could finally mark dead-code this issue here would heave popped up much earlier, I guess.

Not to have usage sides (in tests and / or examples) is risky. I've broken code by one of the first attempts for the "implicit / given" refactoring without noticing. Only after manually testing I've found out that I may not change all implicit classes to extensions. With proper tests this wouldn't have happened.

(Like said, it could be even that now the methods discussed here in this ticket are broken also…)

Thanks for looking into the testing issue in general! This will help reduce the risk of breakage by clueless people a lot! :smile:

MateuszKowalewski commented 1 year ago

As there is already a ticket regarding testing this can be closed I guess.