Skip to content
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

Add ENV signature #812

Merged
merged 1 commit into from
Nov 11, 2021
Merged

Add ENV signature #812

merged 1 commit into from
Nov 11, 2021

Conversation

ksss
Copy link
Collaborator

@ksss ksss commented Oct 22, 2021

ENV is an instance of Object class.
But, RBS does not have syntax for extended object.
Therefore, I introduce the temporary defined class ENVClass.

Options not selected

interface _ENV

interface _ENV
end
::ENV: _ENV

😁 No need to introduce a new class.
😥 interface does not include Enumerable.

singleton methods

class ENV
  def self.[]: (String) -> String?
end

😁 No need to introduce a new class.
😥 It's not correct and does not include Enumerable.

Special implementation

Special implementation in external tool (steep) for ENV.

😁 No need to introduce a new class.
😥 Eventually, we'll need a type definition.

Add syntax for extended object to RBS

(sample)

def ENV.[]: (String) -> String?

😁 Can be expressed correctly.
😥 Just for the ENV?

`ENV` is an instance of Object class.
But, RBS does not have syntax for extended object.
Therefore, I introduce the temporary defined class `ENVClass`.
Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Thank you for reporting a really interesting problem. I don't know what to do for ENV...

Merging this PR for now. 🙏

@soutaro soutaro merged commit 19d0869 into ruby:master Nov 11, 2021
@ksss ksss deleted the env branch November 11, 2021 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants