Hi all.
This is the release of BPatterns project, one of my old ideas on how to
make the rewrite engine usable for scripting.
As a quick reminder, here is an example of the classic rewrite-engine
matching syntax:
@receiver isNil ifTrue: @nilBlock
In practice, patterns like this usually live inside string literals—hidden
away in lint rules, deprecations, or refactorings.
To use them for manual code search or rewriting, you typically need a
dedicated tool.
Now compare that with the same pattern expressed as a BPattern:
[ any isNil ifTrue: anyBlock ] bpattern
No special syntax.
No magical tools.
Just pure Smalltalk.
You write a block.
You send #bpattern.
You’re done.
Every editor understands it.
Every tool respects it.
Want to see where this pattern appears?
[image: Screenshot 2026-01-31 at 12.16.19.png]
Want to rewrite all of them?
[[ any isNil ifTrue: anyBlock ] -> [ any ifNil: anyBlock ]] brewrite
preview
[image: Screenshot 2026-01-31 at 12.17.57.png]
Because BPatterns are real Smalltalk code, all development tools work out
of the box:
syntax highlighting, completion, navigation, refactorings.
This is the rewrite engine treated as a first-class citizen.
Not strings.
Not tooling sidecars.
Not just for advanced users.
A rewrite engine you can actually use.
A rewrite engine at your fingertips.*
More details are in the blog post:
https://dionisiydk.blogspot.com/2026/02/bpatterns-rewrite-engine-with-smalltalk.html
And follow the project on GitHub:
Excellent!
That is so welcome!!
On Mon, Feb 2, 2026, 04:52 Denis Kudriashov via Pharo-users <
pharo-users@lists.pharo.org> wrote:
Hi all.
This is the release of BPatterns project, one of my old ideas on how to
make the rewrite engine usable for scripting.
As a quick reminder, here is an example of the classic rewrite-engine
matching syntax:
@receiver isNil ifTrue: @nilBlock
In practice, patterns like this usually live inside string literals—hidden
away in lint rules, deprecations, or refactorings.
To use them for manual code search or rewriting, you typically need a
dedicated tool.
Now compare that with the same pattern expressed as a BPattern:
[ any isNil ifTrue: anyBlock ] bpattern
No special syntax.
No magical tools.
Just pure Smalltalk.
You write a block.
You send #bpattern.
You’re done.
Every editor understands it.
Every tool respects it.
Want to see where this pattern appears?
[image: Screenshot 2026-01-31 at 12.16.19.png]
Want to rewrite all of them?
[[ any isNil ifTrue: anyBlock ] -> [ any ifNil: anyBlock ]] brewrite
preview
[image: Screenshot 2026-01-31 at 12.17.57.png]
Because BPatterns are real Smalltalk code, all development tools work
out of the box:
syntax highlighting, completion, navigation, refactorings.
This is the rewrite engine treated as a first-class citizen.
Not strings.
Not tooling sidecars.
Not just for advanced users.
A rewrite engine you can actually use.
A rewrite engine at your fingertips.*
More details are in the blog post:
https://dionisiydk.blogspot.com/2026/02/bpatterns-rewrite-engine-with-smalltalk.html
And follow the project on GitHub:
- https://github.com/dionisiydk/BPatterns
-
Is the "classic" rewriting syntax documented anywhere?
On Mon, 2 Feb 2026 at 22:52, Denis Kudriashov via Pharo-users <
pharo-users@lists.pharo.org> wrote:
Hi all.
This is the release of BPatterns project, one of my old ideas on how to
make the rewrite engine usable for scripting.
As a quick reminder, here is an example of the classic rewrite-engine
matching syntax:
@receiver isNil ifTrue: @nilBlock
In practice, patterns like this usually live inside string literals—hidden
away in lint rules, deprecations, or refactorings.
To use them for manual code search or rewriting, you typically need a
dedicated tool.
Now compare that with the same pattern expressed as a BPattern:
[ any isNil ifTrue: anyBlock ] bpattern
No special syntax.
No magical tools.
Just pure Smalltalk.
You write a block.
You send #bpattern.
You’re done.
Every editor understands it.
Every tool respects it.
Want to see where this pattern appears?
[image: Screenshot 2026-01-31 at 12.16.19.png]
Want to rewrite all of them?
[[ any isNil ifTrue: anyBlock ] -> [ any ifNil: anyBlock ]] brewrite
preview
[image: Screenshot 2026-01-31 at 12.17.57.png]
Because BPatterns are real Smalltalk code, all development tools work
out of the box:
syntax highlighting, completion, navigation, refactorings.
This is the rewrite engine treated as a first-class citizen.
Not strings.
Not tooling sidecars.
Not just for advanced users.
A rewrite engine you can actually use.
A rewrite engine at your fingertips.*
More details are in the blog post:
https://dionisiydk.blogspot.com/2026/02/bpatterns-rewrite-engine-with-smalltalk.html
And follow the project on GitHub:
- https://github.com/dionisiydk/BPatterns
-
Yes. There is nice help presenter in the Pharo:
StRewriterHelpBrowserPresenter new open
[image: Screenshot 2026-02-03 at 10.15.45.png]
вт, 3 февр. 2026 г. в 01:36, Richard O'Keefe raoknz@gmail.com:
Is the "classic" rewriting syntax documented anywhere?
On Mon, 2 Feb 2026 at 22:52, Denis Kudriashov via Pharo-users <
pharo-users@lists.pharo.org> wrote:
Hi all.
This is the release of BPatterns project, one of my old ideas on how
to make the rewrite engine usable for scripting.
As a quick reminder, here is an example of the classic rewrite-engine
matching syntax:
@receiver isNil ifTrue: @nilBlock
In practice, patterns like this usually live inside string
literals—hidden away in lint rules, deprecations, or refactorings.
To use them for manual code search or rewriting, you typically need a
dedicated tool.
Now compare that with the same pattern expressed as a BPattern:
[ any isNil ifTrue: anyBlock ] bpattern
No special syntax.
No magical tools.
Just pure Smalltalk.
You write a block.
You send #bpattern.
You’re done.
Every editor understands it.
Every tool respects it.
Want to see where this pattern appears?
[image: Screenshot 2026-01-31 at 12.16.19.png]
Want to rewrite all of them?
[[ any isNil ifTrue: anyBlock ] -> [ any ifNil: anyBlock ]] brewrite
preview
[image: Screenshot 2026-01-31 at 12.17.57.png]
Because BPatterns are real Smalltalk code, all development tools work
out of the box:
syntax highlighting, completion, navigation, refactorings.
This is the rewrite engine treated as a first-class citizen.
Not strings.
Not tooling sidecars.
Not just for advanced users.
A rewrite engine you can actually use.
A rewrite engine at your fingertips.*
More details are in the blog post:
https://dionisiydk.blogspot.com/2026/02/bpatterns-rewrite-engine-with-smalltalk.html
And follow the project on GitHub:
- https://github.com/dionisiydk/BPatterns
-
Thank you. One of the reasons given for introducing BPatterns is a subtle
difference between
single backticks and double backticks, which is mentioned but not explained
in the BPatterns
blog entry. The help screen you directed me to does not explain that.
Is there any documentation which is complete and proofread?
On Tue, 3 Feb 2026 at 23:16, Denis Kudriashov dionisiydk@gmail.com wrote:
Yes. There is nice help presenter in the Pharo:
StRewriterHelpBrowserPresenter new open
[image: Screenshot 2026-02-03 at 10.15.45.png]
вт, 3 февр. 2026 г. в 01:36, Richard O'Keefe raoknz@gmail.com:
Is the "classic" rewriting syntax documented anywhere?
On Mon, 2 Feb 2026 at 22:52, Denis Kudriashov via Pharo-users <
pharo-users@lists.pharo.org> wrote:
Hi all.
This is the release of BPatterns project, one of my old ideas on how
to make the rewrite engine usable for scripting.
As a quick reminder, here is an example of the classic rewrite-engine
matching syntax:
@receiver isNil ifTrue: @nilBlock
In practice, patterns like this usually live inside string
literals—hidden away in lint rules, deprecations, or refactorings.
To use them for manual code search or rewriting, you typically need a
dedicated tool.
Now compare that with the same pattern expressed as a BPattern:
[ any isNil ifTrue: anyBlock ] bpattern
No special syntax.
No magical tools.
Just pure Smalltalk.
You write a block.
You send #bpattern.
You’re done.
Every editor understands it.
Every tool respects it.
Want to see where this pattern appears?
[image: Screenshot 2026-01-31 at 12.16.19.png]
Want to rewrite all of them?
[[ any isNil ifTrue: anyBlock ] -> [ any ifNil: anyBlock ]] brewrite
preview
[image: Screenshot 2026-01-31 at 12.17.57.png]
Because BPatterns are real Smalltalk code, all development tools work
out of the box:
syntax highlighting, completion, navigation, refactorings.
This is the rewrite engine treated as a first-class citizen.
Not strings.
Not tooling sidecars.
Not just for advanced users.
A rewrite engine you can actually use.
A rewrite engine at your fingertips.*
More details are in the blog post:
https://dionisiydk.blogspot.com/2026/02/bpatterns-rewrite-engine-with-smalltalk.html
And follow the project on GitHub:
- https://github.com/dionisiydk/BPatterns
-
Hi Richard.
I checked the code and the double backticks are for the recursion mode. It
forces the search to dive into the current matching node to find more cases
inside it.
For example:
(instVar isNil ifTrue: [ 'inside recursion' ]) isNil ifTrue: [ 'outer node'
]
The syntax with single backtick will not find the internal "instVar isNil"
expression.
In BPatterns the recursion mode is enabled by default for the pattern
variables. So the default mode covers the maximum scope for a search.
Currently you can't not disable the #recurseInto flag as there is not
suitable accessor for this. But if it would be there the pattern would like:
[ anyVar isNil ifTrue: anyBlock ] bpattern with: [ anyVar ] -> [:pattern |
pattern recurseInto: false ]
Anyway I adjusted my blog accordingly. Thanks for the attention.
вт, 3 февр. 2026 г. в 10:47, Richard O'Keefe raoknz@gmail.com:
Thank you. One of the reasons given for introducing BPatterns is a subtle
difference between
single backticks and double backticks, which is mentioned but not
explained in the BPatterns
blog entry. The help screen you directed me to does not explain that.
Is there any documentation which is complete and proofread?
On Tue, 3 Feb 2026 at 23:16, Denis Kudriashov dionisiydk@gmail.com
wrote:
Yes. There is nice help presenter in the Pharo:
StRewriterHelpBrowserPresenter new open
[image: Screenshot 2026-02-03 at 10.15.45.png]
вт, 3 февр. 2026 г. в 01:36, Richard O'Keefe raoknz@gmail.com:
Is the "classic" rewriting syntax documented anywhere?
On Mon, 2 Feb 2026 at 22:52, Denis Kudriashov via Pharo-users <
pharo-users@lists.pharo.org> wrote:
Hi all.
This is the release of BPatterns project, one of my old ideas on how
to make the rewrite engine usable for scripting.
As a quick reminder, here is an example of the classic rewrite-engine
matching syntax:
@receiver isNil ifTrue: @nilBlock
In practice, patterns like this usually live inside string
literals—hidden away in lint rules, deprecations, or refactorings.
To use them for manual code search or rewriting, you typically need
a dedicated tool.
Now compare that with the same pattern expressed as a BPattern:
[ any isNil ifTrue: anyBlock ] bpattern
No special syntax.
No magical tools.
Just pure Smalltalk.
You write a block.
You send #bpattern.
You’re done.
Every editor understands it.
Every tool respects it.
Want to see where this pattern appears?
[image: Screenshot 2026-01-31 at 12.16.19.png]
Want to rewrite all of them?
[[ any isNil ifTrue: anyBlock ] -> [ any ifNil: anyBlock ]] brewrite
preview
[image: Screenshot 2026-01-31 at 12.17.57.png]
Because BPatterns are real Smalltalk code, all development tools
work out of the box:
syntax highlighting, completion, navigation, refactorings.
This is the rewrite engine treated as a first-class citizen.
Not strings.
Not tooling sidecars.
Not just for advanced users.
A rewrite engine you can actually use.
A rewrite engine at your fingertips.*
More details are in the blog post:
https://dionisiydk.blogspot.com/2026/02/bpatterns-rewrite-engine-with-smalltalk.html
And follow the project on GitHub:
- https://github.com/dionisiydk/BPatterns
-