Prevent cloning of clones

Brian Rice water at tunes.org
Mon Apr 25 14:07:59 PDT 2005


On Apr 25, 2005, at 1:43 PM, Brian Rice wrote:
> I strongly suggest that you just forget about this issue and don't 
> worry about the safety factor for now. Focus on the real design issues 
> first; your code is a mess and is not re-using the very useful library 
> I mentioned above. Try this instead:
>
> load: 'src/lib/dimensioned.slate'.
> SVG addImmutableSlot: #Pixel valued: (BaseUnit name: 'pixel' abbrev: 
> 'px').
>
> Doesn't that look better? It also can be used for actual algebraic 
> operations, e.g.:
>
> Slate> BaseUnit name: 'pixel' abbrev: 'px'.
> px
> Slate> 4 with: pixel.
> 4_px
> Slate> it * 5.
> 20_px
> Slate> it / (1 with: in).
> 20_px/in

And if you define:

x@(UnitValue traits) / y@(Unit traits)
[x / (1 with: y)].

Then "(72 with: px) / in" works. I'll add that now to the main source 
tree.

> The underscores are not really suitable for output into XML, but you 
> can easily do something different there, or we could fix the print-out 
> or provide some other means. In any case, you have multi-dispatch and 
> can handle the case specifically in any output method.



--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/




More information about the Slate mailing list