Re: no names allowed, we serve types only

From: Kevin Kirkpatrick <kvnkrkptrck_at_gmail.com>
Date: Fri, 19 Feb 2010 11:42:11 -0800 (PST)
Message-ID: <8a2fe1d6-e3f6-440c-a3de-52be3d7969c3_at_g11g2000yqe.googlegroups.com>


On Feb 19, 2:35 am, David BL <davi..._at_iinet.net.au> wrote:
> On Feb 19, 1:33 pm, Tegiri Nenashi <tegirinena..._at_gmail.com> wrote:
>
> > Types are entirely misguided approach to physical units. Much more
> > elegant way is to operate units as if they are numbers, for example
> > the expression 10 * kg / (10 * sec^2) is multiplication/division of 4
> > number-like entities. One can use the laws of associativity/
> > commutativity and reduce it to 1 * kg/sec^2.
>
> Interesting and that does look elegant.  Are you suggesting the
> computer manipulates these symbolic expressions so as to rearrange
> them into a canonical form
>
>    value * unit
>
> (i.e. units are moved to the right hand side of a multiplicative
> expression).
>
> How does validation fit in, if it's not part of the type system?  I'm
> guessing it's based on unification of symbolic expressions.   Is that
> right?
>
> I believe the design/implementation of a DBMS is normally broken up
> into rather distinct "layers", one of which deals with domain support
> (both built-in and user-defined types) and another that deals with the
> RM itself and treats domains as generic types.
>
> I'm struggling to understand how a domain datatype could support units
> in the way you describe without the generic RM layer ending up
> physically recording a unit against every recorded numerical value.
> Obviously that's not practical.
>
> If a numerical data type supports units then it must record the unit
> as part of an encoded value.  If it doesn't then the unit must be
> associated statically with the data type itself, contrary to your
> claim that types are a misguided approach to physical units.  Is it
> possible to evade that conundrum?

Looks like MS has recently worked this into their F# language, by allowing units as parameterizations of types.

Interesting series of blogs that delve into it in great depth: http://blogs.msdn.com/andrewkennedy/archive/2008/08/20/units-of-measure-in-f-part-one-introducing-units.aspx Received on Fri Feb 19 2010 - 20:42:11 CET

Original text of this message