@bronsa: so I've been digging on that fn .withMeta
thing you pointed out yesterday, and I'm pretty much convinced that the AFn.withMeta
is dead code.
ObjExpr.compile
already creates .withMeta()
and .meta()
implementations unconditionally both for deftypes and fns. Demo of this behavior above. If the default abstract class implementation were running, then that vary-meta
invocation would have returned a different class type.
don't think that's true
IIRC it does that only for reify
ompiled from "test.clj"
public final class test$fn__18 extends clojure.lang.AFunction {
public test$fn__18();
Code:
0: aload_0
1: invokespecial #9 // Method clojure/lang/AFunction."<init>":()V
4: return
public static java.lang.Object invokeStatic();
Code:
0: aconst_null
1: areturn
public java.lang.Object invoke();
Code:
0: invokestatic #14 // Method invokeStatic:()Ljava/lang/Object;
3: areturn
public static {};
Code:
0: return
}
well, is that jaunt or clojure? :simple_smile:
I have no idea what changes you made
but in clojure that's definitely not the case
That's Jaunt. I haven't deliberately changed anything there yet...
sigh
may the Old Ones smile on you
oh my god
this is disgusting
probably
withMeta
is only emitted if the function already has metadata at compile-time
e.g. ^:foo (fn [])
will have it, (fn [])
won't
Yes.
reason why you're seeing it everywhere in Jaunt is because you're attaching :uses
etc
Right. Because that's how it makes the MetaExpr(FnExpr, MapExpr) work.
I agree that should be unconditional.
I guess just make supportsMeta
return true in FnExpr
rather than checking for hasMeta
then
sgtm.
The other thing I want to do here is ditch that MetaExpr
, metadata should be in a Fn's <cinit>
Eh.... that's actually not critical. Whatever.
meh.
@arrdem: or maybe even make supportsMeta
test hasMeta || hasPrimSigs
that's the only case where that makes a difference
or not, if you want to avoid forcing the applyTo
path I guess
Eh. I'm content to hard code supportsMeta
true, right and avoid the applyTo
path.
Two line change and a bunch of deletions. Best kinda patch.
downside is every fn is now ~300bytes heavier
Not even...
Derp. I didn't read carefully. You were dead on.
Eh. The price of sanity. I'm willing to pay it and after all this is my sandbox 😛