  Following Britz, Johnsen, Mayhew and Shiromoto, we consider demi\-ma\-troids
as a(nother) natural generalization of matroids. As they have shown,
demi\-ma\-troids are the appropriate combinatorial objects for studying Wei's
duality. Our results here apport further evidence about the trueness of that
observation. We define the Hamming polynomial of a demimatroid $M$, denoted by
$W(x,y,t)$, as a generalization of the extended Hamming weight enumerator of a
matroid. The polynomial $W(x,y,t)$ is a specialization of the Tutte polynomial
of $M$, and actually is equivalent to it. Guided by work of Johnsen, Roksvold
and Verdure for matroids, we prove that Betti numbers of a demimatroid and its
elongations determine the Hamming polynomial. Our results may be applied to
simplicial complexes since in a canonical way they can be viewed as
demimatroids. Furthermore, following work of Brylawski and Gordon, we show how
demimatroids may be generalized one step further, to combinatroids. A
combinatroid, or Brylawski structure, is an integer valued function $\rho$,
defined over the power set of a finite ground set, satisfying the only
condition $\rho(\emptyset)=0$. Even in this extreme generality, we will show
that many concepts and invariants in coding theory can be carried on directly
to combinatroids, say, Tutte polynomial, characteristic polynomial, MacWilliams
identity, extended Hamming polynomial, and the $r$-th generalized Hamming
polynomial; this last one, at least conjecturelly, guided by the work of
Jurrius and Pellikaan for linear codes. All this largely extends the notions of
deletion, contraction, duality and codes to non-matroidal structures.
