Fork me on GitHub
#clojure-dev
<
2017-11-16
>
bronsa16:11:30

any particular reason why IPersistentSet has its own get(Object) and doesn't implement ILookup?

alexmiller17:11:38

IPersistentSet almost certainly pre-dates ILookup (which was added later)

alexmiller17:11:59

is IPersistentSet.get() really the same intent as ILookup.valAt()?

bronsa17:11:31

I'd say so

bronsa17:11:00

this comes from a discussion over #clojure-uk where i was explaining why it doesnt make sense for sets to be IAssociative, but I was quite surprised to find out that they weren't ILookup

bronsa17:11:56

if there's no good semantical reason (and I can't think of one!) for IPS to be an ILookup i'd be tempted to make an enhancement ticket

alexmiller17:11:20

adding ILookup to IPersistentSet would be a breaking change for existing (non-core) impls of IPS

alexmiller17:11:31

could be added to Set impls though

alexmiller17:11:20

that would theoretically make calls to sets of keywords faster?

bronsa17:11:30

I believe so

bronsa17:11:57

hmm, wait, depends on what you're talking about :)

bronsa17:11:12

if you meant because of KeywordLookup, no

alexmiller17:11:21

no, I meant on get

bronsa17:11:24

that's only there as an inline cache for record access IIRC

bronsa17:11:34

would avoid being routed through getFrom

bronsa17:11:24

not specific to sets of keywords tho