This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-20
Channels
- # announcements (2)
- # beginners (108)
- # cljdoc (9)
- # clojars (1)
- # clojure (33)
- # clojure-spec (20)
- # clojure-uk (9)
- # clojurescript (23)
- # datascript (1)
- # datomic (5)
- # emacs (3)
- # fulcro (15)
- # graphql (1)
- # jobs (7)
- # lumo (12)
- # off-topic (40)
- # ring-swagger (1)
- # shadow-cljs (1)
- # tools-deps (7)
- # unrepl (6)
- # vim (1)
so, I just learned that you can't overload functions by type, but only by arity 😋 . for some reason in my mind this was a possibility. any ideas how I can achieve the same effect, but keeping the type anotations, to avoid reflection?
@dadair yes, that's probably the best solution. I was actually thinking about something along the lines of a static dispatch based on the type since it is known (=assumed) at compile time. but I suppose this needs to be a compiler provided construct.
have been messing around a bit more with the prepl
and noticed that the outputs are sometimes still not read
able
{:tag :ret, :val #object[clojure.lang.Namespace 0x7a9e38e4 "user"], :ns user, :ms 0, :form *ns*}
in this case #object
will cause a reader exception (“No reader function for tag object”)
This is data and is readable (with an appropriate tagged literal reader).
just so I know - as far as this output goes, you are saying that it’s expected behaviour?
Last entry there might be interesting to you
yes, I noticed in my experiments that the vals of the unknown tags were generally readable
They should always be readable
Just an idea we’ve kicked around
@raymcdermott Perhaps #clojure-dev
I have a dilemma naming a function that works in a similar way to isa?
except it also returns true when the record in question implements a protocol. Should I name it iskind?
or looks-like?
or something else ?
implements?
follows? might also work, at least for me protocols are something "to be followed" outside the programming realm.
Clojure 1.9.0
+user=> (doc satisfies?)
-------------------------
clojure.core/satisfies?
([protocol x])
Returns true if x satisfies the protocol
nil
Thanks for the input, I'll go for "follows?", it's vague I like it, it fits well to that specific use-case. "implements?" would mix with java's jargon (typically, you extend a class and implement an interface).