-
Notifications
You must be signed in to change notification settings - Fork 38
Support referencing one constant in another constant #53
Comments
Hm, I'm not sure if this is a good can of worms to open: "place-halo": "country-halo",
"country-halo": "place-halo" |
@tmcw Can you elaborate? :) |
In the example that I posted: if you support variables referencing each other, you support referencing each other in infinite loops: place-halo goes to country-halo, and vice versa, forever. We can detect these kinds of loops, but they make the implementation a little more complex. Variable references will also make debugging a bit trickier - instead of just saying "constant reference here was invalid", we'd have to look up possibly multiple levels of reference to give a more specific error. |
@tmcw I see. I had assumed in that example that it would error right away because the first constant is trying to reference a constant that has not yet been defined, but I didn't realize that the order does not matter. If we don't think that referencing constants within constants is a good idea, perhaps we should just push this type of functionality to the future GUI, and not worry about it for now? |
👍 This is something we can keep in our pocket for now and implement in a GUI after we have more knowledge of how we visually design maps anyway. |
@nickidlugash Is this still needed given current UI technology? |
@jfirebaugh the current UI is not yet there to support something like this (this is basically the idea behind constant transforms, but it is not implemented yet). I think we're pretty set on this eventually being something the UI will handle though, so we can close here. |
Um...maybe not? #38 (comment) |
Haha... oops, I guess there's a downside to merging the history. This bug was closed by a commit from the lint repository that fixed cutting-room-floor/mapbox-gl-style-lint#53. |
RIP constants. |
Can we support referencing one constant in another constant?
E.g.
"place-halo": "#faf3ed ",
"country-halo": "place-halo"
Or
(The syntax in the second example is not valid – I just made it up to demonstrate that the ability to reference other constants could be useful once we have color functions: #38)
The text was updated successfully, but these errors were encountered: