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. Addition should work between compatible units, but 
still throw an error for incompatible units. An error should be thrown 
when attempting to print a value with a complex unit, like px/in or px^2.

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.

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/f750bc541c1a6d2e83d0ed82cc162bd3f0f3c6df
>
> 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