Hello Dario,

> CCSS is a preprocessor for CSS (Cascading Style Sheets), extending the
> language with arithmetic operations and variables.

Yes, that's badly missing in CSS.

>  - The arithmetic operations are unit-aware, and will complain if you
>   try adding apples and oranges, for example.

Unit aware is good but the classes should be broader. I find it
disappointing that it won't allow you to add mm to cm correctly, since
it's supposed to be unit aware.

In CSS there are two kinds of units : relative and absolutes ones [1].
Each relative one should be in a different class as there are no known
conversion function between them (they depend on font metrics or on
the display). But all the absolute ones should be in the same class
and arithmetic between them should be performed correctly since the
conversion functions are known. I would thus suggest the following
incompatible classes of unit of measure :

* em
* ex
* px
* in, mm, cm, pt, pc

You'll need a convention for the unit of the result of an expression
with different absolute dimensions. A good way of achieving that would
be to use the unit of the leftmost term in the parse tree of the
expression, that way if you need to you can always get the unit you
want by writing e.g. 0mm + (exp).

>From a user perspective, it makes it much easier to copy paste
snippets from here and there without having to bother to normalize
every length to a single unit.

Other than that, the syntax you chose blends well with css.

Best,

Daniel

[1] http://www.w3.org/TR/CSS21/syndata.html#length-units

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to