Brevity is a library that enables Feature-Oriented Programming (FOP) and solves the expression problem in a manner that makes data and operation declarations trivial to define and compose.
If there are a set of related functions that need to be defined together how is that accomplished?
Example: Ordering in Haskell
data Ordering = LT | EQ | GT deriving
(Eq, Ord, Bounded, Enum, Read, Show)
class Eq a where
(==), (/=) :: a -> a -> Bool
x /= y = not (x == y)
x == y = not (x /= y)
class (Eq a) => Ord a where
compare :: a -> a -> Ordering
(<), (<=), (>=), (>) :: a -> a -> Bool
max, min :: a -> a -> a
compare x y | x == y = EQ
| x <= y = LT
| otherwise = GT
x <= y = compare x y /= GT
x < y = compare x y == LT
x >= y = compare x y /= LT
x > y = compare x y == GT
-- Note that (min x y, max x y) = (x,y) or (y,x)
max x y | x <= y = y
| otherwise = x
min x y | x <= y = x
| otherwise = y
Early thoughts are that traits should define the name explicitly and not rely on the variable name itself:
If there are a set of related functions that need to be defined together how is that accomplished?
Example: Ordering in Haskell
Early thoughts are that traits should define the name explicitly and not rely on the variable name itself:
Then support direct trait composition:
Having
complect
as well asmerge
doesn't seem reasonable so can these be combined?What does it mean to try and merge two factories?
What does it mean for a trait to try an extend
ord
?If complect is subsumed by
merge
and some data/trait tries to extend merged, how does that work?