Now that #24960 is merged, it's important that we think through its implications. In particular, for types where we used a foo[:bar]
API, we should strongly consider changing it to foo.bar
using getproperty
.
In particular, I'm thinking of factorization objects like qrfact
, where we currently use QR[:Q]
. It seems like QR.Q
would be a lot more natural.
I'm almost done with this so I'll open a PR shortly.
Besides factorization objects, the only other place where this idiom seems to be used is getindex(m::RegexMatch, name::Symbol)
, which should possibly be changed too?
I can work on that one, since I've been doing some other work that touches regexes anyway.
Although that's a little different since we do want to do m.match
and m.captures
to get at what the match object matched and captured. I guess I could change m.captures
to a RegexCaptures
object that is both indexable like an array of strings and that you can do m.captures.name
on. But I'm not sure that's worth it since writing m[:name]
is quite a bit shorter anyway.
I think we should keep m[:name]
for Regex (or use m["name"]
?). The QR change seems pretty clearly better though.
Most helpful comment
I'm almost done with this so I'll open a PR shortly.