Use declare
when defining classes?
#618
gefjon
started this conversation in
Ideas and Proposals
Replies: 1 comment
-
Excellent idea, and for typeclasses with values/constants as well as functions:
then
|
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
-
Corollary to discussion 616.
I'm very unsure whether this is a good idea or not, but it seems like if we want to make this change, as early as possible is the time to do it:
Should typeclass definitions use the
declare
keyword to define method signatures?e.g. should the
Eq
class be:Pros:
Cons:
The breakage of this change could be alleviated by allowing both the
declare
version and the bare version; treating both the existing classdef forEq
and the one above as equivalent. In my dream, we'd write a version where thedeclare
form is preferred, and the bare form signals a style-warning; later we'd upgrade to a warning; and even after that we'd upgrade to a hard error. But like I said, this is just a rough sketch, and I think I could probably be convinced pretty easily that the current syntax is better, or that the cost of switching is too high.Beta Was this translation helpful? Give feedback.
All reactions