Repository navigation
Conversation
A cut is now a module prepended to its class. Module#prepend is what Ruby took from the proposal for cuts, so the library no longer has to imitate one by overriding Object.new and extending each object. Cuts now apply to objects made before the cut and to subclasses. The AOP layer is rebuilt on the same footing: a CrossCut carries a class's aspects, covers methods defined later, passes on keywords and blocks, and keeps private methods private. The README gains the history of the proposal, Matz's reply and prepend's arrival in Ruby 2.0. QED demonstrations are added, one of them setting a cut beside a prepended module. Tests move from MicroTest to Spectrum. Plain gemspec and CI on Ruby 3.1 to 4.0. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cuts are where Ruby's
Module#prependcame from. This makes the library say so, and builds it onprepend.The history (a draft, to be corrected)
The README has a new section, "What Became of Cuts", drafted from Trans's account: the design with Peter Vanbroekhoven, the proposal, Matz's suggestion of
prependand his question whether it would be sufficient, the argument for the cut as a class, andprepend's arrival in Ruby 2.0 in 2013. Please read it for accuracy and tone; it is written in your voice ("we argued…") and is yours to reword.The existing "History" section is kept, put into the past tense: Suby and the RCRFoundry no longer exist, the dead Suby link is dropped, and its closing sentences about hoping for a Ruby-core implementation are removed, since the new section answers them. Spelling is corrected, and Peter's name is spelled Vanbroekhoven throughout.
A cut is now a prepended module
Until now a cut had to be imitated:
Object.newwas overridden, and each new object was extended with its class's cuts. NowCut.new(klass)prepends itself to the class.Object.newis no longer overridden.Cut#baseis added, and modules can be cut as well as classes.:a < :bworks again. Thecut :Name < Klasstrick used to break the comparison of two symbols; it is now itself a cut of Symbol that falls back withsuper.The AOP layer
Rebuilt on the same footing, with the same API (
Aspect.new,join,apply,target.super):CrossCutcarries a class's aspects. It covers methods defined after an aspect was applied, and objects made before.Demonstrations and tests
prepend(the same class done both ways, with the same result and the same ancestors), and aspects.Version is set to 2.0.0, with the History entry marked unreleased.
🤖 Generated with Claude Code