This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-08-11
Channels
- # admin-announcements (36)
- # beginners (1)
- # boot (267)
- # cider (19)
- # cljs-dev (12)
- # clojure (149)
- # clojure-austin (4)
- # clojure-canada (1)
- # clojure-czech (3)
- # clojure-dev (31)
- # clojure-japan (2)
- # clojure-uk (22)
- # clojurebridge (3)
- # clojurescript (314)
- # clojutre (18)
- # core-async (8)
- # cursive (4)
- # datascript (1)
- # datomic (27)
- # editors (2)
- # events (80)
- # hoplon (13)
- # javascript (2)
- # jobs (5)
- # ldnclj (12)
- # ldnproclodo (1)
- # off-topic (4)
- # re-frame (21)
- # reagent (87)
- # testing (13)
alexmiller: http://clojure.org/java_interop doesn't mention ^""
or the equivalent #^""
classname hints for arrays and other types. Just had a heck of a time finding out that was a feature.
arrdem: yeah, I've got an old todo to fix exactly that
arrdem: actually, I todid it at http://clojure.org/java_interop#Java%20Interop-Aliases - did you not see that?
alexmiller:
> long arrays (long-array []) have a type of "[J".
is intended to be interpreted as ^"[J"
will work?
I read that as "here's a list of the special case symbols for things you can't reasonably hint", not "you have this string escape hatch and here's some helpers".
no, don't think so - that would be ^(Class/forName "[J") wouldn't it?
the other aspect is that it matters whether you are talking about on a var vs param/return of a defn
var meta hints are evaluated so you can do stuff like that
(but ^longs etc won't work)
in a defn however they are not evaluated and things like ^longs will work
(I'm going from memory, so this could be off)
I'll trust you, don't have a REPL handy. Was trying to make ^[T]
for T a legal type alias work.
I don't think that's a thing
in either place :)
@alexmiller @arrdem: Also, generally type hints on fn args generally have to be fully qualified, and not on var meta hints
Is there a reason why var hints are treated specially and evaluated? This seems like a "pick one and stand by it" case.
I actually talked to Rich about this the other day and he said there was a point in time where a decision needed to be made on this and a fork in the road was chosen. It was unclear at the time how they would be used.
so, it's mostly historical afaict
and probably difficult to change either now w/o breaking things
yeah, as soon as Java gets there we'll think about that :)
@alexmiller: If a fork in the road were to be taken, would it be for evaluating hints or not evaluating them?