[code-reflection] Integrated: Single method to append an operation to a block builder
Paul Sandoz
psandoz at openjdk.org
Thu Jul 10 20:14:54 UTC 2025
On Wed, 9 Jul 2025 20:14:54 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
> Reduce the number of methods to append an operation to a block builder down to a single method.
>
> `Block.Builder` no longer extends from `Function<Op, Op.Result>`, thereby removing the `apply(Op op)` method which just deferred to `op(Op op)`, and when to use which caused confusion. The functional abstraction can be achieved with `Block.Builder::op`.
>
> Remove the method `op` that accepts a operation transformer, overriding the builder's transformer. This was another source of confusion. For the more advanced cases where a different transformer is required, the builder can be rebound to a new builder with a different transformer.
>
> Remove the method `ops` which allowed building within the context of a lambda expression. This can also cause confusion as the builder variable is aliased with the lambda parameter. Such code, if needed can be factored into methods or explicit lambdas.
This pull request has now been integrated.
Changeset: 2b9116c4
Author: Paul Sandoz <psandoz at openjdk.org>
URL: https://git.openjdk.org/babylon/commit/2b9116c466512e8f8bf4aecdf015763289c895d9
Stats: 202 lines in 13 files changed: 1 ins; 80 del; 121 mod
Single method to append an operation to a block builder
-------------
PR: https://git.openjdk.org/babylon/pull/491
More information about the babylon-dev
mailing list