Type conversion (Was: Brain Dump of Towards FIT 1.0 OpenSpace session)

"Jim Little" <[email protected]> Fri, 22 Aug 2003 11:09:25 -0700
Newsgroups gmane.comp.programming.tools.fit.devel
Message-ID <001d01c368d8$89000390$0200a8c0@Phideaux>
From: [email protected]
> at one point I thought of pushing type conversion to the 
> Fixtures themselves; the fixtures, after all, know what's 
> needed better than some global framework. It's still an 
> idea that has a bit of an appeal.

That's kind of how the C# version works.  Type conversion seems to be
the area that differs most across languages.  For the C# version, we
actually ripped out the TypeAdapter class entirely (almost).

In C#, most data types have Parse() and ToString() methods that convert
between strings and data types.  So what we do in C# is say that the
fixture has to accept and return data types that will implement Parse()
and ToString() properly.  Coincidentally, all of the normal types that
people use do.  We then use reflection to handle the string conversion.

This is a nicely elegant solution.  It takes parsing out of TypeAdapter
and fixtures and puts it in the data type where it belongs.

But I can't see how this would work in a language without manifest
types.  How do the other ports deal with type conversion?

Jim