Skip to content

Add meaningful names to AnnotatedString annotations to make their usage understandable #55249

Closed
@aplavin

Description

@aplavin

This is IMO quite unintuitive and confusing to read:

julia> s = Base.AnnotatedString("this is an example annotated string", [(1:18, :A => 111), (12:28, :B => 222), (18:35, :C => 333)])

julia> Base.annotations(s)[2][1]
12:28

julia> Base.annotations(s)[2][2][1]  # or Base.annotations(s)[2][2].first
:B

julia> Base.annotations(s)[2][2][2]  # or Base.annotations(s)[2][2].second
222

Would be much nicer and self-explanatory to use meaningful names instead of numbers:

julia> Base.annotations(s)[2].region
12:28

julia> Base.annotations(s)[2].label
:B

julia> Base.annotations(s)[2].value
222

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions