I think it would be a good idea to have a subcategory of associative algebras
(and inheritance of classes from an associative class). Morphisms need to
know to check associativity.
On the other hand, I was convinced years ago (by an argument of Bergman
at Berkeley) that algebras should be unital. A non-unital "algebra" can be
embedded in a universal unital algebra, such that the non-unital object is a
In Magma, I find it awkward that the algebras include the ideals, and there is
no class (type in Magma) to know whether an "algebra" admits a morphism
from its base ring or is just a module. Consequently Ideals as objects of study
is essentially absent in Magma. E.g. ideals over a number ring are hacked
as elements of a (fractional) ideal group or ideal monoid, but do not support
Peter argues that certain Hecke algebras are non-unital, but should these
not be viewed as ideals? I would be tempted to have associative algebras
inherit from unital algebras, and to view non-unital "algebras" as ideals.
The (important) case of Lie algebras is worth considering, whether it is too
restrictive to assume that a general Lie algebra is an ideal over a universal
algebra. This would conflict with the usual definition (a Lie algebra "over R"
has no embedding of R). Moreover, should the * operation be the Lie bracket,
or be reserved for its envelopping algebra? (Using [x,y] would be nice but
would conflict with lists.) With * as the algebra operation, do the special
properties of Lie algebras (e.g. the set-theoretic inclusion in an envelopping
algebra is not a homomorphism) suggst they should be implemented outside
the class and categorical hierarchy of algebras. To me, the main question
is whether one needs morphisms between Lie algebras and associative or
non-associative algebras, and (in practice) what code can be shared between
the associated classes. It seems clear that Lie algebras need to inherit from
general (non-unital non-associative) algebras, but the relation with other
algebras needs some consideration.
The unital condition is important because it determines whether it is reasonable
to coerce an element of the base ring, or dismiss such a request without
solving a potentially hard question whether there exists a canonical embedding.
For a unital algebra, we want to require an efficient canonical coercion from
the base ring, whereas for ideals, either a not implemented error or a potentially
expensive but correct algorithm would be acceptable and expected.
In short, to the extent possible I would impose the unital condition as widely as
possible, and develop the ideal theory of algebras in its own right.