I'm a bit confused about why this seems so contentious. Isn't clojure.core/get fundamentally an abstract operation on collections which support "lookup" in some way by key? What is the purpose of abstract data types if not to solve this very problem? It seems to me Clojure was designed specifically to enable this type of uniform access pattern. The underlying type should not matter.
On Wednesday, August 5, 2015 at 11:03:32 AM UTC-4, David Nolen wrote: > If you have to fall through so many cases to get to the Object case why would > you not just use `goog.object/get`? > > > This type of convoluted convenience over just doing the right thing is never > going to land in ClojureScript. > > > > > > David > > > On Wed, Aug 5, 2015 at 10:58 AM, Peter Taoussanis <[email protected]> wrote: > > There is no simple test for plain objects, `typeof x` will return > > `"object"` for many things. only `foo.constructor === Object` is going to > > work. This is not as fast as it would seem. > > > > The test would be slow, but the cost only incurred when `get` is called on > something that's: > > not nil, not an array, not a string, and that doesn't implement ILookup. > > > > Is there maybe a use case I'm missing why someone would realistically be > calling `get` for something not covered by one of the above? > > > > > We're not going to add any more cases to `get`. I've said all I'm going to > > say about this matter :) > > > > Just trying to understand your rationale David, it's likely you're aware of > something that I'm not. > > > > > > -- > > Note that posts from new members are moderated - please be patient with your > first post. > > --- > > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > > To post to this group, send email to [email protected]. > > Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
