Skip to content

Proposal: make differences-from-react.md example-first #351

Closed

Description

@aleclarson

Context

docs/differences-from-react.md documents nuanced compiler and runtime contracts, but many sections currently lead with dense prose. For a React user evaluating or migrating to Octane, that often means mentally executing the described compiler rule before discovering its practical authoring consequence.

My perspective is:

  • Octane's differences from React are genuinely complex.
  • Keeping the document vertically short does not make those differences simple.
  • Minimal syntax and observable outcomes can expose the complexity more honestly than compressed prose.
  • Examples should replace repetitive explanation, not merely make the document longer.

Proposed direction

Make the guide example-first where a divergence affects authoring or observable behavior:

  • Lead syntax differences with a minimal React/Octane comparison.
  • Show compiler decisions as small qualifying/non-qualifying examples.
  • Show timing differences as short sequences with the expected observation.
  • Use tables for decision matrices such as custom-hook inference and known optimization gaps.
  • Keep prose for qualifications, guarantees, and implementation constraints that examples cannot express safely.
  • Avoid examples for implementation differences whose observable result is intentionally identical, such as the reconciler's choice of physically moved nodes.

The highest-value examples cover:

  • conditional hooks and the plain-JavaScript-loop exception;
  • inferred, explicit, empty, and null hook dependencies;
  • automatic memoization and derived-value caching eligibility;
  • current-state getters;
  • native events and controlled inputs;
  • attribute and class composition behavior;
  • scheduler and parallel-use() timing;
  • root entry points, lazy(), error boundaries, and refs;
  • SSR, streaming, and hydration behavior.

Prototype

I prepared a documentation-only prototype on my fork:

The prototype:

  • increases focused code examples from 5 to 24;
  • reduces prose outside code blocks by roughly 400 words;
  • keeps the total word count essentially unchanged;
  • adds compact tables for dependency inference, custom wrappers, and parallel-use() gaps;
  • splits the dense SSR section into rendering, streaming, and hydration;
  • preserves the existing behavioral claims;
  • passes the repository-wide formatting check.

The line diff is larger because code and tables are vertically spacious. The intended tradeoff is lower reading and reconstruction cost, not a broader documentation scope.

Feedback requested

If this direction seems useful, I am happy to open a PR from the prepared branch. Review would be especially helpful on:

  • whether any example is technically misleading without additional context;
  • whether shortened prose loses an important qualification;
  • whether any example adds visual weight without improving comprehension.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions