You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lot of classes and traits in this code base have an Alg suffix (FileAlg, GitAlg or SbtAlg for example) which is an abbreviation for algebra. The term is often used in the context of the tagless final encoding for embedding domain specific languages (DSLs) where the algebra is a set of operations over some types which are commonly encoded as traits. But in this code base Alg is not only used for algebras in the tagless final sense but also for final classes (which are sometimes called programs) that take algebras or other programs as parameters. This overly broad usage of the Alg suffix for things that are not algebras is one reason why I grew to dislike it over time and would like to replace it.
Another argument against using that term is that our algebras do not have associated laws that relate the different operations and types to each other. In the context of programming I think of an algebra as a combination of three things: types, operations, and laws. If our "algebras" do not have laws that allow us to restructure our programs according to them without changing their semantics, it is IMO a misnomer to call them algebras.
I'm currently tending to replace Alg with Dsl which I think fits equally well for traits and final classes. The final classes are just higher-level DSLs which are implemented in terms of lower-level DSLs (the traits or other final classes).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
A lot of classes and traits in this code base have an
Alg
suffix (FileAlg
,GitAlg
orSbtAlg
for example) which is an abbreviation for algebra. The term is often used in the context of the tagless final encoding for embedding domain specific languages (DSLs) where the algebra is a set of operations over some types which are commonly encoded astrait
s. But in this code baseAlg
is not only used for algebras in the tagless final sense but also forfinal class
es (which are sometimes called programs) that take algebras or other programs as parameters. This overly broad usage of theAlg
suffix for things that are not algebras is one reason why I grew to dislike it over time and would like to replace it.Another argument against using that term is that our algebras do not have associated laws that relate the different operations and types to each other. In the context of programming I think of an algebra as a combination of three things: types, operations, and laws. If our "algebras" do not have laws that allow us to restructure our programs according to them without changing their semantics, it is IMO a misnomer to call them algebras.
I'm currently tending to replace
Alg
withDsl
which I think fits equally well fortrait
s andfinal class
es. Thefinal class
es are just higher-level DSLs which are implemented in terms of lower-level DSLs (thetrait
s or otherfinal class
es).Beta Was this translation helpful? Give feedback.
All reactions