I was (pleasantly) surprised that the code Locus("complement(2258..2449)").position actually worked, when Locus("complement(2258..2449)") |> typeof |> fieldnames showed only (:loc,)!
That's when I learned that the dot syntax is actually lowered to getproperty and not getfield! With that being said, the default implementation of Base.propertynames (used for the REPL autocomplete, among other things) doesn't know about the implementation you added that made .position work!
In fact, currently running Locus("complement(2258..2449)") |> typeof |> propertynames not only doesn't return position or loc, but it returns a number of things that I can't access with the dot operator at all: (:name, :super, :parameters, :types, :instance, :layout, :hash, :flags).
I think this could be solved with an implementation of Base.propertynames for Complement (and friends)!
Let me know if you agree / would like me to put in a PR!
I was (pleasantly) surprised that the code
Locus("complement(2258..2449)").positionactually worked, whenLocus("complement(2258..2449)") |> typeof |> fieldnamesshowed only(:loc,)!That's when I learned that the dot syntax is actually lowered to
getpropertyand notgetfield! With that being said, the default implementation ofBase.propertynames(used for the REPL autocomplete, among other things) doesn't know about the implementation you added that made.positionwork!In fact, currently running
Locus("complement(2258..2449)") |> typeof |> propertynamesnot only doesn't returnpositionorloc, but it returns a number of things that I can't access with the dot operator at all:(:name, :super, :parameters, :types, :instance, :layout, :hash, :flags).I think this could be solved with an implementation of
Base.propertynamesforComplement(and friends)!Let me know if you agree / would like me to put in a PR!