[Mapcss] Eval isn't really needed

Sebastian Spaeth Sebastian at SSpaeth.de
Wed Jul 7 14:36:56 BST 2010


On 2010-07-07, Andrew O. Shadoura wrote:
>   height: eval("2*2");
I would agree, quotes are good.

> Moreover, I think we don't need eval as such, we can just drop it:
>   height: 2*2;
> This won't slow down parsers, as it's easy to check if rule contains eval, 
> using this regexp:
> 
> ^([a-z-]+)[ ]*:[ ]*("([^\x22]*)"|([0-9,.]+)|(#[,0-9a-fA-F]+)+)

I don't like it :-). Using eval it is clear something dynamic is going
to happen. What with the "2*2" bar? Is 
   name: 2*2
a string ('2*2') or to be evaluated? 

What if I want to draw name tags for large features only?
  name: eval("if ((area)>100) (tag(name)) ('')")

Still that easy to identify? I am not especially attached to eval(), but
just allowing inline calculations does not seem very appealing to me.

Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/mapcss/attachments/20100707/e9c4e99e/attachment.pgp>


More information about the Mapcss mailing list