Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[ANN] CCSS 1.0
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-03-11 (19:00)
From: Dario Teixeira <darioteixeira@y...>
Subject: Re: [Caml-list] [ANN] CCSS 1.0

> The problem is that different kind of objects naturally use different
> kind of units. A font size or line height for example is usually
> expressed in pts and a standard paper or photographic print size will
> be in cms (or inches).

Sure, and nothing stops you from using those different units in different
contexts.  CCSS only constrains you if you try doing *arithmetic* with
those units, which I posit should rarely be an issue, precisely because
they live in different contexts.

But anyway, I've implemented unit conversion, which you can find in SVN [1].
In the next release this feature may be activated at user discretion.

Units are divided into four categories, and units within the same category
may be mixed.  The result gets the same unit as the first operand.  The
categories are as follows:

   length: mm, cm, in, pt, pc
    angle: deg, grad, rad
     time: ms, s
frequency: hz, khz

In the following example, the output for all properties will be "2in":

  foo1: 1in + 1in;
  foo2: 1in + 2.54cm;
  foo3: 1in + 25.4mm;
  foo4: 1in + 72pt;
  foo5: 1in + 6pc;

Best regards,
Dario Teixeira