Standardising "getters" #3547
GerardoFurtado
started this conversation in
Ideas
Replies: 1 comment
-
The outerRadius can be specified either as a constant or as a function of the datum, and the code normalizes constant values to a function. If we wanted to change that, then the API would return inconsistently either a function or a constant—and this would put the burden on any client code to check whether it's a function or a number, possibly retransforming the constant to a function. (Also, it would be backwards-compatible.) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are all quite used to the D3 way of passing no arguments to a method for getting its current value. For instance,
scale.domain()
will get the scale's domain, and so on...However, this approach will fail for some methods: for instance, if I have a given arc generator, using
arc.outerRadius()
will not return me the current outer radius, but the accessor function instead, so I have to doarc.outerRadius()()
.What about standardising that approach? For the example above, the source code could be:
Beta Was this translation helpful? Give feedback.
All reactions