Open gavinking opened 5 years ago
Couldn't you still import them from inside the class?
import ceylon.language { Comparison { ... } }
Also, were you planning of keeping the toplevels as deprecated until say 1.5?
Couldn't you still import them from inside the class?
Yes, of course.
Also, were you planning of keeping the toplevels as deprecated until say 1.5?
I guess we could do that.
Also, were you planning of keeping the toplevels as deprecated until say 1.5?
I guess we could do that.
Except 1.4 is the release that is breaking stuff. I would rather break everything cleanly at the same time....
I recall the renamed
or similar annotation in some other issue.. It could be used here, if not to maintain compatibility then to help IDEs fix your code with minimum fuss.. Like an action in a Quick-Fix or similar popup:
`smaller` was renamed to `Comparison.smaller` - apply change
Yes, there is an aliased
annotation already.
:heart_eyes:
Would it propose importing Comparison
and replace code with Comparison.smaller
OR would import directly similar to the import
statement in my earlier comment?
Not a big deal either way, but I like them being toplevels; less hassle and clutter with imports.
Is there any practical benefit to requiring the import?
What has really bugged me is the top-level function smallest()
, which is ungrammatical for smaller()
. If we're going to change things up, I think it would be worth exploring other words to resolve the overload, like lesser
and greater
.
+1 I don't feel comparison to be a feature of the language itself, so I like comparison related objects having its own scope.
In the case of smaller/equal/larger being in the language module, they did not yet interfere with my usage for them. But in general, I dislike things in the global namespace with general names that interfere with variable or method names I'd like to use. (Most painful occurrence is the name value
, of course). So I'd tend to put as few things into the global namespace as possible.
@someth2say given the fact that ceylon defines its comparison operators by the Comparable
interface, I'd indeed say they belong to the language. But nevertheless, I (slightly) tend to put them in the Comparison
namespace.
What has really bugged me is the top-level function
smallest()
, which is ungrammatical forsmaller()
.
Right, well that's the thing, I always wanted to call that function smaller()
. But I couldn't because that name was taken.
@someth2say given the fact that ceylon defines its comparison operators by the
Comparable
interface, I'd indeed say they belong to the language. But nevertheless, I (slightly) tend to put them in theComparison
namespace.
Right, the general principle is that anything used to define the syntax of the language goes in ceylon.language
. (Otherwise we would have split all metamodel stuff out into its own module a long time ago.)
You can try this out on the 7409
branch.
I've always hated that the cases of
Comparison
(smaller
,larger
,equal
) pollute the toplevel namespace ofceylon.language
.I could change the definition of
Comparison
to this:So you would write
Comparison.smaller
,Comparison.larger
,Comparison.equal
.This would be a breaking change, of course.
WDYT, folks?