Skip to content

Ban VarNames with ranges or Colons in the middle #149

@mhauru

Description

@mhauru

These sorts of VarNames are non-sense, and I think the constructor should call them out and error:

julia> @varname(a.b[1:4].c)
a.b[1:4].c

What would this mean? It could mean get the elements a.b[1:4] and get the field .c for each of them. However, that's not what this does in Julia. Rather, in Julia, indexing like that tries to get the field .c of the object a.b[1:4], which is probably an Array that only has fields ref and size. I don't think that's ever the thing we want to do in a probabilistic programming language context. Hence I think VarNames should allow an IndexLens with ranges or Colons only as the last lens.

Note that this should of course still be fine: @varname(a.b[2].c)

Metadata

Metadata

Assignees

No one assigned

    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