-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename isleaftype
#17086
Comments
Leaf does not mean it is branched off from somewhere, but that it cannot be branched off from. |
In Java you have both leaf types ( |
The terminology used in the manual seems to stick to concrete |
Searching julia-users for "leaf type" returns 8 results, for "concrete type" 351. +1 for |
@JeffBezanson Do you support this change as well? |
The primary issue is that we don't clearly define what "leaf type" and "concrete type" are - this came up recently in a discussion with @janvitek @lkuper. Consider a few candidate definitions (insert "leaf type" or "concrete type" in the blanks below):
Definition 1 can be made tautological. Here is a table I made testing some of these definitions using introspection from the Julia REPL: We can rule out Definition 4 since it precludes bits types like Intuitively, one wants to say that the remaining definitions (2, 3, 5, 6) are equivalent, but I'm not entirely sure that they are. |
Actually being able to make an instance of something should not be part of the definition, because it is too operational. For example, if all the constructors for a type happen to throw errors, saying it's not a (concrete|leaf) type is misleading --- the type object itself will still share all relevant properties with other concrete types. Definition 5 will be right after #8974, since then we will no longer allow types with unbound parameters (they will have to be wrapped in UnionAll types). With that caveat, I believe 3, 5, and 6 are equivalent. The one exceptional case is the singleton types like
For most types these are equivalent. |
Footnote: I believe we could fix the monkey business by making the tag of |
Do we really need to solve the question of the exact definition to decide on the best naming? As noted above, the documentation already uses |
If there is no useful distinction between "leaf type" and "concrete type", then it would be a moot point. However, I very strongly suspect that if we went through our documentation, we would see that there is a conflation of Definition 2 and Definitions 3/5/6 in our usage of the terms, even though we treat them colloquially as interchangeable. |
Yes, it is quite possible we've used "concrete" to refer to a nominal type declared with |
As can be seen at https://github.com/JuliaLang/julia/pull/20709/files#diff-2df71755503be40d805334f1bef57673, there's only a handful of uses of "leaf" or "leaf type" in the documentation. So that's easy to check. |
I've attempted to put together a list of all of the type-classification queries that I think are meaningful. Of these, only two don't currently exist: type queries
structure queries
isleaftypeSo what should be the fate of |
Good list. I agree with the definition of |
While re-reading the manual I realized that
isleaftype
should probably be renamed to eitherisconcretetype
orisconcrete
:The documentation for
isleaftype
does clearly explain it returns true for concrete types which seems like the function name is slightly misleading.The text was updated successfully, but these errors were encountered: