Seeing as you brought up implementation details, I was wondering if you could clarify something for me. I asked a question about keyword arguments and how they’re stored, but I wasn’t really satisfied with the answer, so I was hoping to get a second opinion.
When a structure (NamedTuple
,LinearIndices
,etc) is considered an implementations detail, is to okay to use that structure?
In the case of keyword arguments, it’s really a Iterator.Pairs()
holding a NamedTuple
, and the documentation clearly states it. You can use values()
to extract the NameTuple
and access the elements by keywords. However, does relying on it being a NamedTuple
make the code fragile? I’m assuming if it does change in the future, the documentation would be updated to reflect that, and even if it isn’t, you can call typeof()
to view the type of structure. Would it be better to create your own NamedTuple
as demonstrated in the linked answer?
In the context of LinearIndices
, should I just rely on the fact I have an iterable, rather than a more specific structure?