Fork me on GitHub

Alex's response to the "Why not IFn?" question reminds me of a viewpoint on clj maps I've had for a while but haven't heard anybody else articulate (you could apply this to other dynamic languages too) that their use falls into two disjoint patterns A) homogeneous maps, which are unbounded in size and have keys of one specific type and values of another specific type (i.e., s/map-of) B) heterogeneous maps, which have keys that are names taken from a known and probably very small set, and the values are arbitrary but typed specific to individual keys (i.e., s/keys) so my interpretation of alex's comment about defrecord is that "defrecord is only for type B"

💯 4
Alex Miller (Clojure team)01:11:05

In Rich speak, “mechanism vs information”


and also I would say that the IFn interface is only for type A


I think of IFn on map (and get) being for type A, while IFn on keywords is for type B

Alex Miller (Clojure team)01:11:39

Instead of IFn for keywords, I would call it ILookup


ILookup is the interface the arg is expected to satisfy, right?


okay, so I was talking about (:foo m) calls; it's true that m satisfies ILookup in this case, but it's the fact that the keyword is being called as a function that I want to highlight, so I can't see why talking about "IFn for keywords" doesn't accomplish that


I assume the ILookup comment also applies to (get m :foo), so it wouldn't seem to distinguish the case I'm trying to


there's a parallel distinction you could make for sequential structures; sequences vs tuples, or something of that sort


most statically typed languages have totally different constructs for the different cases, so distinguishing them isn't as useful


can also be interesting to note that JSON seems aimed at a paradigm where type A doesn't exist -- that's why its maps can only have string keys


or structs vs. maps


Woah does defstruct still exist


I haven't thought about it in like seven years


and it's not even deprecated!


Does it compile to a special class?


no it's got no special compiler support


just a regular data structure impl, but I have no idea how it works :)

Yehonathan Sharvit15:11:03

I am reading the datatype official material at And it mentions “host-in-parens constructs” What is the meaning of “host-in-parens constructs” in this context? ” They support, in a relatively clean manner, access to the highest-performance primitive representation and polymorphism mechanisms of the host. N.B. that they are not merely host-in-parens constructs. ”


i take this to mean they are not merely host constructs "parenified". ie, they aren't just java classes written with parens instead of {

Alex Miller (Clojure team)16:11:44

They are exactly the same as if you invoked a java object through a polymorphic method in Java (there is no extra Clojure var overhead or anything)

Yehonathan Sharvit16:11:39

You mean from a performance perspective?

Alex Miller (Clojure team)16:11:42

From all perspectives :)

Alex Miller (Clojure team)16:11:54

But yes, the implication is perf

Yehonathan Sharvit16:11:05

So conceptually, they are different: they are opiniated , they are the Clojure way of doing OO but there are no performance penalties for that. In short: We benefit from the best of both worlds metal

Alex Miller (Clojure team)17:11:41

fast case is fast, “slow” case is open (still fast due to cache)


is it expected that AOT compiled namespaces lose metadata?


$ clj -Sdeps '{:deps {datascript {:mvn/version "0.16.8"}}}'
Clojure 1.9.0
user=> (require 'datascript.arrays)
user=> (find-ns 'datascript.arrays)
#object[clojure.lang.Namespace 0x76911385 "datascript.arrays"]
user=> (meta (find-ns 'datascript.arrays))


I was going to say "expected in that it is a known issue" but it looks like maybe it should be fixed, it may depend on the version of clojure the ns was aot compiled with


also, what makes you think that is an aot compiled namespace?


if datascript artifacts contain aot compiled code I am going to be so sad


and it looks like it's compiled with 1.7


which explains the bug


those jerks


now my beautiful code is tied to the 1.7 abi, wonderful


(holy shit 1.8 was 3 years ago, what is happening to time)


Time did not change, bronsa, you got older 🙂

😛 12
lol 4