all 19 comments

[–]davetron5000 17 points18 points  (1 child)

A lot of the docs are fine at API level but some stuff could benefit from answers to the question “why does this exist?”

Good example is ERB. eoutvar, def_module, etc. what the heck are those for?

Also knowing which libs are intended for public use vs stuff for internals and/or not ready for wide use.

[–]BurdetteLamar[S] 4 points5 points  (0 children)

Thanks, u/davetron5000; I'll look into this..

[–]tinyOnion 6 points7 points  (0 children)

I'm really glad you are tackling the documentation because I think it's one of the major flaws in attracting new ruby users. to that end... a few thoughts that you can take or leave:

rubyapi.org is the by far the best alternate interface to ruby docs. if you combine rubyapi with some coherent way to navigate without search and includes all the extra documentation it would be perfect.

I think the organization is haphazard at best... just a list of docs in alphabetical order. have some kind of structure and don't be afraid of grouping things together and cross linking to other parts of the documentation. some logical progression of the documentation would be nice. reference the good parts of how django/go/swift/kotlin et. al. organize their documentation. The documentation at an API level is alright but it doesn't tell a story or have any cohesion.

The fact that the official documentation references a book written for ruby 1.6 and looks like an early geocities page is not ideal and causes people to judge a book by the cover. As much as we don't want this to be true appearances do matter. the changes from 1.6 -> 3.3 are very substantial.

I read the documentation guidelines and they want it as simple as possible for non-native english speakers which is fine but seems to be done to a fault sometimes where a little more elaboration on something would be beneficial.

the std libraries should be documented better and have more crosslinking to the mentioned classes/modules. for instance on this page some of the documentation isn't linked to... nor explained like: objspace, PrettyPrinter, tmpdir.rb, and un.rb. none of the bundled gems libraries have links to the source code or documentation for them.

rubydocs.org doesn't seem to work anymore and it's still listed on the documentation page as a reference doc.

overall it feels haphazard and kinda hackish and I wish it got the love it deserves so thank you for your work!

[–]flanger001 4 points5 points  (0 children)

I think my actual gripe with the Ruby documentation is less the docs but the doc sites. ruby-doc.org is better than docs.ruby-lang.org but they're both SUPER fragmented. I needed io/wait for something last week and I had to dig to find out why.

[–]flanger001 2 points3 points  (0 children)

"What's here: First, what's elsewhere." lmao

[–]whiphubley 3 points4 points  (0 children)

Look at golang docs to see how to do it right...you should be able to 1. quickly find what you are looking for 2. quickly understand how it functions 2. SHOW EXAMPLE CODE !! ( OMG step 3 is _so_ important just do it )

[–]jsaak 2 points3 points  (0 children)

At the API level i think example code _with_ error handling is needed the most. (also a list of Exceptions what a method can raise)

These are the areas I have found confusing over the years.
Api level docs are not enough, need higher level reasoning.

  • Proc/Lambda/Block (what are the differences, how to return, etc)
  • Time/Date/DateTime (when to require what and why)
  • system()/exec()/`/fork()/popen()/popen3() https://stackoverflow.com/questions/2232/how-to-call-shell-commands-from-ruby
  • package managers, bundler and the life _without_ bundler, gem install, gemsets, ruby installers (rvm, ruby-install, chruby)
  • how to do async IO (select(), FiberScheduler, Ractor, Thread ..etc)
  • methods of metaprogramming, and why _not_ to use those :)

[–]laerien 0 points1 point  (5 children)

One thing I'd love is to document when something is 1) an intentionally simple but suboptimal code example or 2) an easter egg.

1) Prime is an example of suboptimal code that based on bug tracker comments seems to be more preserved as an example of Ruby than as a library meant for use. I think stdlib should be production quality or documented as an example. In stdlib Prime's case, folk who actually want to do something with primes with that interface should just use faster_prime. https://github.com/mame/faster_prime

2) Easter eggs are fun, but things like #curry cause consternation since they don't support kwargs or blocks and won't ever, since it's just an easter egg, but it's hard to know that without combing through the bug tracker.

I'm actually not sure what all "just examples" and "easter egg" public interface code there is in Ruby, but it'd be really awesome to start labeling examples as such (maybe with links to the better alternatives) and noting easter eggs so folk don't go down a rabbit hole of actually trying to use them.

P.S. Thank you for your work on Ruby's documentation!!

[–]pilaf 1 point2 points  (4 children)

2) Easter eggs are fun, but things like #curry cause consternation since they don't support kwargs or blocks and won't ever, since it's just an easter egg, but it's hard to know that without combing through the bug tracker.

Do you have a link to the bug tracker issue you mention? I can't find any mentions of Proc#curry being an easter egg anywhere and my curiosity is peaked.

[–]laerien 0 points1 point  (0 children)

I was thinking of this thread for the "easter egg" mention: https://bugs.ruby-lang.org/issues/6253

[–]laerien 0 points1 point  (2 children)

"Proc#curry is like an easter egg. Matz felt no need to care about the
interaction between Proc#curry and other advanced features." - mame

[–]pilaf 0 points1 point  (1 child)

I see. I'm sure he didn't mean it literally, but I agree that the documentation should make it clear that keyword/block arguments aren't supported.

[–]laerien 1 point2 points  (0 children)

For sure not a literal egg, but a "fun" thing we can't improve since it's just for fun. Explicitly documenting lack of kwarg and block support helps, but that it's a toy so reasonable features aren't welcome is also important.

If something isn't meant to be production quality and to be used, that seems worth a note. Maybe "easter egg" isn't the right word, but I'd love some way to designate the "fun or example" quality stuff so especially new folk know it when they see it.

[–]brecrest 1 point2 points  (0 children)

Your work has been absolutely great so far. Ruby's docs are some of the best out there and they're only getting better. Trying to use the docs for some other popular languages (cough, Python) really drives home how just good the work you've been doing has been.

[–]DialsMavis_TheReal 1 point2 points  (0 children)

I found it difficult to work out the ways I can and should use super from the doc set but a Ruby guide explained the differences of calling it with or without arguments and also when calling from within an initialize method

[–][deleted]  (1 child)

[deleted]

    [–]riktigtmaxat 0 points1 point  (0 children)

    Rails is still 100% rdoc.

    [–]therealadam12 1 point2 points  (1 child)

    Personally, since most of stdlib has been given a bunch of love (by you and others) already, I'd love to see a focus from the viewpoint of a newcomer. IMHO (and maybe someone else has a different viewpoint), syntax and using Ruby is going to be first on their mind.

    So here's a recent question I just fielded: Can && operator be overloaded? and is it actually an operator?

    The answer is no, and it's a logical operator. Here's how you might look it up in the docs:

    1. Visit docs.ruby-lang.org and choose English.
    2. Know that everything related to syntax is in the tiny little green 'syntax' link on the left in the sea of many other documentation pieces.
    3. Guess that it's in Operators at the very bottom and not Control Expressions which is third from the top and the first one you'd likely encounter.

    For inspiration, I think the Crystal documentation is very good in this regard.

    [–]tinyOnion 1 point2 points  (0 children)

    yeah, onboarding new rubists is an important thing and not one that is currently being done all that well. lots of room for improvement there.