Replies: 7 comments
-
I agree that something like The Julia style guide also suggests having no underscores for simple names. Though that is rather subjective...
|
Beta Was this translation helpful? Give feedback.
-
I think we followed that rule that underscores come in only when they are needed for readability. What could help additionally would be erroring on nonexistent keyword attributes and giving suggestions. Then one could quickly find misspelled variants. |
Beta Was this translation helpful? Give feedback.
-
Right but I'm not sure it works in practice because "needed for readability" is so subjective. So now the result is that it's difficult to guess when there should be an underscore. Who would guess that It would be great to make this more predictable.
Yes I think something in this direction is a good idea: identify some "grammar" rules that work well. Looking at the existing keywords, it seems that underscores are most often used in the following cases:
I think both rules make a lot of sense:
|
Beta Was this translation helpful? Give feedback.
-
Let's see what happens if we apply the suggested rules: use underscores systematically around verbs and prepositions and other-level things (like "mouse"), and never otherwise. Click to expand the list at the bottom to see all the Makie keywords (probably not an exact list) with
I think the suggested list really makes things more consistent and predictable without hurting readability. In a couple of cases it would make things worse, but then it can make sense to further change the keyword:
Note: I removed Suggested vs original keywords (click to expand)
What do you think? |
Beta Was this translation helpful? Give feedback.
-
This just tripped me up as well. Furthermore it seems, that e.g. for Legend no keyword checks are in place. So having label_font like in Figure just changes nothing... |
Beta Was this translation helpful? Give feedback.
-
Ok, since this has been converted to a discussion, let's discuss. I like the proposed changes and have only four points: 1) Keep |
Beta Was this translation helpful? Give feedback.
-
streamplot
has attributesarrow_head
andarrow_size
whilearrows
has the same without underscore. Looking at the different plotting functions, it appears that the vast majority of attributes has no underscore, so it would make sense to rename thestreamplot
attributes?More generally, it might improve usability to have all attributes without underscores, maybe with some well thought exceptions?
Of course removing underscores reduces the readability of the attribute, but I think in most cases, having a uniform API gives a gain in usability that outweighs the loss in readability.
The following bash script (run from the Makie.jl directory) tries to find all the attributes with underscores:
Here are the results (probably with some false positives and some results missing):
Attributes with underscores (click to expand)
Some possibilities:
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions