Skip to content

Unify member accessor contract - #987

Merged
sebastienros merged 5 commits into
mainfrom
sebros/optimize-member-expression
Aug 20, 2026
Merged

Unify member accessor contract#987
sebastienros merged 5 commits into
mainfrom
sebros/optimize-member-expression

Conversation

@sebastienros

Copy link
Copy Markdown
Owner

Member access currently uses separate synchronous, asynchronous, and engine-native accessor paths. This consolidates them into one contract so every accessor can return a FluidValue directly without maintaining parallel dispatch and source-generation logic.

Changes

  • Replace IMemberAccessor, IAsyncMemberAccessor, and the internal direct-value accessor path with MemberAccessor.GetAsync, returning ValueTask<FluidValue>.
  • Update emitted, reflection, delegate, method, and source-generated accessors to use the unified contract.
  • Preserve configured value converters, exact-name and wildcard registrations, cache invalidation, dotted-name fallback, and NativeAOT reflection fallback.
  • Document custom MemberAccessor implementations and conversion helpers.

Breaking change

Custom accessor implementations now derive from MemberAccessor. This is intentional for the next breaking release.

Performance

Order-balanced, three-launch FluidBenchmarks.Render runs showed no measurable change:

Revision Mean Allocated
origin/main 16.41 us 36.26 KB
This branch 16.42 us 36.26 KB

The change is intended as API and implementation simplification, not a performance claim.

Validation

  • dotnet test Fluid.Tests/Fluid.Tests.csproj -c Release
  • dotnet test Fluid.Tests/Fluid.Tests.csproj -c Release /p:Compiled=true
  • dotnet build Fluid/Fluid.csproj -c Release for netstandard2.0, net8.0, net9.0, and net10.0
  • Source-generated accessor smoke coverage for sync, Task<T>, ValueTask<T>, custom converters, generic registrations, and dotted access

sebastienros and others added 5 commits August 19, 2026 15:21
Canonicalize identifiers per template and let built-in member accessors return FluidValue directly on the rendering hot path.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace the split synchronous, asynchronous, and FluidValue accessor interfaces with a single MemberAccessor abstraction that returns ValueTask<FluidValue>. Update runtime, reflection, generated, and registered accessor paths to use the engine-native value contract directly.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9a5b2c42-bcdc-4c1f-b0c4-26e49441e90b
Restore direct identifier string creation during parsing and remove the parse-local canonicalization state and its reference-identity test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9a5b2c42-bcdc-4c1f-b0c4-26e49441e90b
Describe migration from the removed accessor interfaces to MemberAccessor, including conversion helpers, nil semantics, and exact-name registration.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9a5b2c42-bcdc-4c1f-b0c4-26e49441e90b
Document only the current MemberAccessor API without describing compatibility or removed interfaces.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9a5b2c42-bcdc-4c1f-b0c4-26e49441e90b
@sebastienros
sebastienros merged commit 1f3138d into main Aug 20, 2026
3 checks passed
@sebastienros
sebastienros deleted the sebros/optimize-member-expression branch August 20, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant