Unit values
    David Hopwood 
    david.nospam.hopwood at blueyonder.co.uk
       
    Wed Apr 27 07:41:52 PDT 2005
    
    
  
Brian Rice wrote:
> On Apr 26, 2005, at 11:50 AM, Adde wrote:
> 
>> I added the px method to Number traits to be able to say: 1 px instead 
>> of 1 with: px, don't know if that's a good idea but it certanly makes 
>> it easier to use. The other methods are just placeholder for 
>> XML-specific formatting.
> 
> The "px" message idea has occurred to me before, and I think what I'll 
> do is have the BaseUnit creation method name:abbrev: create the method 
> for you so you don't have to do it. How does that sound? :)
Suggestion: merge the UnitValue and Unit types, by having a unit behave
as 1 of that unit, i.e. px = 1*px.
Then only multiplication is needed to form a UnitValue, e.g. 42*px.
Similarly examples like "(72*px) / in" would work automatically. This
design also allows derived units and conversion factors to be expressed
more simply.
-- 
David Hopwood <david.nospam.hopwood at blueyonder.co.uk>
    
    
More information about the Slate
mailing list