Comments inline.

On Sep 21, 1:07 pm, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
> The original idea with units was not to go too much into the semantics
> of the units themselves, and to assume that complex semantic issues
> wouldn't come up too often. If we're going to open the door to unit
> handling, we should really handle all of the complex semantic issues.
> Not only should 10px/2px = 5, but 1cm/10 = 1mm, 1px/1in = 1 px/in, 2px *
> 3px = 3px^2, etc.

I agree. Compound units are already handled. conversion between
compatible units is not, but is certainly simple enough using a
conversion table and coercion when possible instead of raising an
error.

> Addition should work between compatible units, but
> still throw an error for incompatible units.

Yep, that's how I've coded it.
http://github.com/chriseppstein/haml/commit/6ac13caee83ac23fe9e99ffbdd4681b6dde0bc80#L1R133

> An error should be thrown
> when attempting to print a value with a complex unit, like px/in or px^2.

Yep, that's how it works.
http://github.com/chriseppstein/haml/commit/6ac13caee83ac23fe9e99ffbdd4681b6dde0bc80#L1R74

> Even then, I'm not sure about allowing 50% * 30px = 15px. In CSS, the %
> unit really means "percent of parent element", so it feels like a bit of
> hack to make 50% equal to 0.5, especially since 0.5 can already be used
> for the same purpose.

I had the same thought earlier and after thinking about it some more
I'm inclined to agree with you.

It sounds like if I iterated on this changeset, you'd be inclined to
pull it in?

Chris

>
> Chris Eppstein wrote:
> > I've been working on porting the Yahoo UI fonts CSS to Sass and hit
> > some snags. Their font system recommends setting fonts using percents
> > instead of pixels or ems. You get some very nice rendering behavior if
> > you use this approach, but it can be cumbersome to be calculating
> > percents all the time so Sass can make using the YUI font system much
> > simpler.
>
> > Unfortunately, using arithmetic with units in sass is not very natural
> > because one would expect 20px/10px to be the unitless number 2, but it
> > is 2px instead.
>
> > Additionally, I expect 50% * 30px to be 15px but it gives an error
> > instead.
>
> > So I made a patch cleans up the code around unit-based numbers:
> >http://github.com/chriseppstein/haml/commit/f750bc541c1a6d2e83d0ed82c...
>
> > Unfortunately, the way the Sass engine works right now, you can't
> > currently store a number with compound units into a variable (say as a
> > conversion factor between two units) even with these changes.
>
> > Would love to see this pulled into the master branch... so that I can
> > start using it in Compass (http://github.com/chriseppstein/compass)
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to