Skip to content

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Jun 1, 2024

It's hard to distinguish code object classes by their file names alone. And given that we have 18 such classes, it'd make the codebase a lot easier to understand if we grouped them into a single directory.

Given that these classes are all autoloaded in lib/rdoc.rb instead of required individually, this change should have minimum impact on projects using RDoc as they generally just require rdoc, not individual files. An example is Rails' sdoc:
https://github.com/rails/sdoc/blob/main/lib/sdoc/rdoc_monkey_patches.rb

It's hard to distinguish code object classes by their file names alone.
And given that we have 18 such classes, it'd make the codebase a lot
easier to understand if we grouped them into a single directory.

Given that these classes are all autoloaded in `lib/rdoc.rb` instead
of required individually, this change should have minimum impact on
projects using RDoc as they generally just require `rdoc`, not individual
files. An example is Rails' `sdoc`:
https://github.com/rails/sdoc/blob/main/lib/sdoc/rdoc_monkey_patches.rb
@hsbt
Copy link
Member

hsbt commented Jun 3, 2024

I'm +1 for this. But I'm not sure how libraries refer these files directory like require "rdoc/context".

Can you investigate that?

@st0012
Copy link
Member Author

st0012 commented Jun 3, 2024

Most of the results are from fork or vendored RDoc. A few gems that actually require RDoc explicitly all have been unmaintained for more than 10 years (example1, example2).

I think it's mostly because 13 years ago RDoc started autoloading those classes. And given the number of the classes needed, most libs probably just switched to require "rdoc" like Rails' sdoc currently does:

Copy link

@simi simi left a comment

Choose a reason for hiding this comment

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

LGTM!

@st0012 st0012 requested a review from colby-swandale June 26, 2024 02:02
@st0012 st0012 merged commit 4211292 into ruby:master Jul 2, 2024
@st0012 st0012 deleted the reorganize-code-object-files branch July 2, 2024 10:15
matzbot pushed a commit to ruby/ruby that referenced this pull request Jul 2, 2024
(ruby/rdoc#1114)

It's hard to distinguish code object classes by their file names alone.
And given that we have 18 such classes, it'd make the codebase a lot
easier to understand if we grouped them into a single directory.

Given that these classes are all autoloaded in `lib/rdoc.rb` instead
of required individually, this change should have minimum impact on
projects using RDoc as they generally just require `rdoc`, not individual
files. An example is Rails' `sdoc`:
https://github.com/rails/sdoc/blob/main/lib/sdoc/rdoc_monkey_patches.rb

ruby/rdoc@4211292ffe
@st0012 st0012 added this to the v6.8.0 milestone Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants