[moby] Re: [MOBY-dev] a question and a comment about the new Objectinheritance

Mark Wilkinson markw at illuminae.com
Thu May 26 15:29:44 UTC 2005


Wow... what a discussion!

I have to throw in my $0.02

I think the Object ontology is "logically" correct exactly as it stands.
It describes the structure of the objects to a machine, while giving
some human-intuitive sense of what the object is supposed to represent
by using a human-intuitive name.

Ben would argue (correct me if I get this wrong) that it is
inappropriate to define particular *types* of strings in the object
ontology because this goes over the line of conflating structure with
semantics.  I tend to disagree - a FASTA file is a particular type of
file format, and it is that *format* that we are describing (i.e. the
structure of the string) not its actual content or meaning.  As such, it
doesn't bother me one little bit that we inherit from String.  And, as
Yan points out, if you want to know if an Object is a String or an Int,
then ask it - the inheritance will tell you.  It strikes me that it is
only laziness that creates the "need" not to inherit from the
primitives; i.e. that it is simply easier to know if you have a
primitive in-hand if the object in-hand is of a primitive type "by
name", rather than a child of a primitive type where yo have to look-up
its parentage.

Inheriting from Primitives also solves a number of other problems v.v.
rendering and such, but I don't want the utility to override the
architecture, so I'll leave that discussion out of it.

My *only* objection to the way things are today is that the
serialization of derivative objects from primitives can end up having
mixtures of XML and text as child nodes in the XML.  This is widely
considered "bad practice" (though not "illegal"), and it makes me a bit
queasy in my stomach every time I see it.  Nevertheless, this problem
can be solved in ways other than preventing inheritance from
primitives!  

Let's get to the root of the problem.  Is the Java community (I finger
you because you are the ones who are reporting this as a problem) really
objecting to inheritance from primitives, or are you objecting to the
way we serialize the ontology?  I tried to type examples of both new
solutions at the meeting, but neither of them seemed acceptable to
anyone, so I gave up...

I remain unconvinced.  I agree that the serialization we have now is
somewhat ugly in some cases, but creating a special class of Objects is
even worse!  If we can solve the Java programmers problem by serializing
objects like this:

<String ns='' id=''>
	<string>content here</string>
</String>

then perhaps that's what we should do in preference to creating special
types of Objects that wrap primitives but cannot have child types.

???

Mark








More information about the MOBY-dev mailing list