Would we want this?
module Notifier
interface!
# ...
end
class SlackNotifier
implements Notifier # ✨
# ...
end
The implementation would literally just be Module.alias_method(:implements, :include)
Pros:
- Reads really nicely, feels native
- Tools can instantly know that
Notifier is an interface, without needing to resolve it first (it likely lives in another file)
Cons:
- Would need special support in Rubydex/RubyLSP. It wouldn't be understood by other tools by default.
- Most tools that handle Ruby understand module inclusion, so they'd know the interface's methods become available on the class. They wouldn't know that about this
implements keyword without having bespoke support built for it.
Originally posted by @amomchilov in #2 (comment)
Would we want this?
The implementation would literally just be
Module.alias_method(:implements, :include)Pros:
Notifieris an interface, without needing to resolve it first (it likely lives in another file)Cons:
implementskeyword without having bespoke support built for it.Originally posted by @amomchilov in #2 (comment)