Skip to content

Enable idiomatic record.pt syntax #112

@Moelf

Description

@Moelf

For Record and RecordArray and SlotRecord etc., currently we have code like this:

Base.getindex(
layout::Record{FIELDS,CONTENTS},
f::Symbol,
) where {FIELDS,CONTENTS<:Base.Tuple{Vararg{Content}}} = layout.array.contents[f][layout.at]

This is blocking usage such as cms_events[1].pt, to unblock it, this can be re-written into:

Base.getindex(layout::Record, f::Symbol)  = getfield(layout, :array).contents[f][getfield(layout, :at)]

Base.getproperty(layout::Record, f::Symbol) = layout[f]

of course we don't have to manually do getfield() if we can come up with an internal API for this.

Metadata

Metadata

Assignees

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