Shopify / Shopify/type_toolkit

Consider `implements MyInterface` syntax

Open
#14 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
3
Forks
5
Avg merge
8d 23h
Merged PRs (30d)
8

Description

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:

  1. Reads really nicely, feels native
  2. Tools can instantly know that Notifier is an interface, without needing to resolve it first (it likely lives in another file)

Cons:

  1. 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 https://github.com/Shopify/type_toolkit/pull/2#discussion_r2850115519

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed Notifier and SlackNotifier example and review the referenced Rubydex/RubyLSP compatibility concerns. Determine whether the project should adopt implements as an alias for include, what tool support would be required, and how completion would be validated.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.