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

Update RBS for Rack #210

Open
2 tasks
ParadoxV5 opened this issue Sep 20, 2022 · 2 comments
Open
2 tasks

Update RBS for Rack #210

ParadoxV5 opened this issue Sep 20, 2022 · 2 comments

Comments

@ParadoxV5
Copy link
Contributor

ParadoxV5 commented Sep 20, 2022

I am currently tinkering with Rack and RBS, using this collection for Rack’s RBS. Unfortunately, it is quite lacklustre. It looks like it was partially prepared by @mame and TypeProf through #36 and never touched since.

  • This RBS document demands a good amount of polishing to be successful.

I’ve inquired about Rack’s opinion on developing RBS themselves through rack/rack#1967. In summary, their consensus is that RBS’s benefits aren’t significant enough to justify the labour of coercing Rack’s duck types to RBS’s static typing. In that discussion, I highlighted: [Update: #232 covers this blockquote]

However, it has possible mistakes and undocumented fields. Examples from Rack::Response alone:

  • The attribute Rack::Response#body should probably follow the SPEC § The Body, but the RBS restricts it to one or an Array of Rack::Lint or nil.
  • I’ve been working around the above with Rack::Response.[], whose args are untyped in the RBS.
  • Rack::Response#each is also missing RBS of &block.
[Significatly modified section starts]
  • Besides filling in the blanks, note that Rack just got a new major version recently (Rack 3). Regarding the leap to Rack 3, a question yet to be answered is if we, as third-party volunteers, should attempt to catch up with Rack’s development (without publishing unusable snapshots) or simply freeze at Rack 2. Keep in Mind that a complete RBS of Rack doesn’t provide a unique convenience (yet) perhaps besides Add rack as a dependency pocke/rbs_rails#174, especially since Rack’s YARDocs and Rack::Lint already detail acceptable types (static or duck) equal to or better than a set of RBS could.
@ParadoxV5 ParadoxV5 changed the title Update RBS for Rack Update RBS for Rack (?) Sep 20, 2022
@ParadoxV5
Copy link
Contributor Author

ParadoxV5 commented Sep 29, 2022

I’m going to (partially) improve the RBS through PR. This doesn’t answer my concern with (consistent) maintenance for Rack 3 though. (It’s better not to have an incompetent tool than to accept its hindrance. (not a proverb))

ParadoxV5 added a commit to ParadoxV5/gem_rbs_collection that referenced this issue Oct 2, 2022
inferred from source code and Rack SPEC
fixes blockquote of ruby#210
@ParadoxV5 ParadoxV5 changed the title Update RBS for Rack (?) Update RBS for Rack Oct 8, 2022
@ParadoxV5
Copy link
Contributor Author

ParadoxV5 commented Oct 13, 2022

Checklist of Classes/Modules (as of #232)

  • [Rack Top-Level]
  • Auth
  • BodyProxy
  • Builder
  • Cascade
  • Chunked
  • CommonLogger
  • ConditionalGet
  • Config
  • ContentLength
  • ContentType
  • Deflater
  • Directory
  • ETag
  • Events
  • Files
  • ForwardRequest
  • Handler
  • Head
  • Lint
  • Lobster
  • Lock
  • Logger
  • MediaType
  • MethodOverride
  • Mime
  • MockRequest
  • MockResponse except
    • Argument errors of #initialize
  • Multipart
  • NullLogger
  • QueryParser
  • Recursive
  • RegexpExtensions
  • Reloader
  • Request except
    • Return of Helpers#body
    • Return of Helpers#logger
    • Return of Helpers#session_options
    • Return of Helpers#parse_multipart
  • Response
  • RewindableInput
  • Runtime
  • Sendfile
  • Server
  • Session
  • ShowExceptions
  • ShowStatus
  • Static
  • TempfileReaper
  • URLMap
  • Utils

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant