Project

General

Profile

Actions

Misc #14610

closed

Enhance Proc docs

Added by zverok (Victor Shepelev) over 6 years ago. Updated almost 6 years ago.


Description

What caught me recently while mentoring students: there is almost no "canonical" explanation about procs in Ruby's core docs: Nothing in doc/*.rdoc, and for the Proc class, documentation of what it is and what it does is pretty spartan.

I am trying to fix this by adding to Proc class header documentation.
Things added:

  1. More friendly and detailed explanation of the whole concept.
  2. Different methods of creating lambda and non-lambda procs.
  3. Lambda semantics.
  4. Conversion to proc from other objects and &.

About (3): currently, Proc docs do have an explanation about it, but there are two problems:

  • it all placed in docs for predicate method #lambda? (like nobody should be interested in the concept unless uses this method);
  • from my perspective, it uses pretty unfortunate wording: instead of talking about proc object semantics, it calls non-lambdas behavior "tricks", and informally tells about "procs with tricks"/"procs without tricks".

If my class documentation would be accepted, I propose to cut the explanations in #lambda? method down to a one-liner ("If the proc has lambda semantics. See class docs for an explanation about lambdas." or something like that.)


Files

proc_docs.patch (6.41 KB) proc_docs.patch zverok (Victor Shepelev), 03/16/2018 11:09 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0