jaunt

:jaunt: a jaunt away from Clojure | <https://www.jaunt-lang.org> | Currently `[org.jaunt-lang/jaunt "0.2.1"]`
arrdem 2016-04-07T18:35:05.000082Z

@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.

arrdem 2016-04-07T18:36:35.000084Z

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.

bronsa 2016-04-07T18:37:26.000086Z

don't think that's true

bronsa 2016-04-07T18:37:33.000087Z

IIRC it does that only for reify

bronsa 2016-04-07T18:37:48.000088Z

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."&lt;init&gt;":()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
}

bronsa 2016-04-07T18:39:52.000090Z

well, is that jaunt or clojure? :simple_smile:

bronsa 2016-04-07T18:39:56.000091Z

I have no idea what changes you made

bronsa 2016-04-07T18:40:04.000092Z

but in clojure that's definitely not the case

arrdem 2016-04-07T18:40:16.000093Z

That's Jaunt. I haven't deliberately changed anything there yet...

bronsa 2016-04-07T18:40:37.000094Z

sigh

arrdem 2016-04-07T18:40:54.000096Z

may the Old Ones smile on you

bronsa 2016-04-07T18:43:19.000097Z

oh my god

bronsa 2016-04-07T18:43:23.000098Z

this is disgusting

arrdem 2016-04-07T18:43:30.000099Z

probably

bronsa 2016-04-07T18:43:39.000100Z

withMeta is only emitted if the function already has metadata at compile-time

bronsa 2016-04-07T18:43:51.000101Z

e.g. ^:foo (fn []) will have it, (fn []) won't

arrdem 2016-04-07T18:43:59.000102Z

Yes.

bronsa 2016-04-07T18:44:04.000104Z

reason why you're seeing it everywhere in Jaunt is because you're attaching :uses etc

arrdem 2016-04-07T18:44:30.000105Z

Right. Because that's how it makes the MetaExpr(FnExpr, MapExpr) work.

arrdem 2016-04-07T18:44:44.000106Z

I agree that should be unconditional.

bronsa 2016-04-07T18:44:56.000107Z

I guess just make supportsMeta return true in FnExpr rather than checking for hasMeta then

arrdem 2016-04-07T18:45:11.000108Z

sgtm.

arrdem 2016-04-07T18:46:09.000109Z

The other thing I want to do here is ditch that MetaExpr, metadata should be in a Fn's <cinit>

arrdem 2016-04-07T18:46:43.000110Z

Eh.... that's actually not critical. Whatever.

bronsa 2016-04-07T18:48:07.000111Z

meh.

bronsa 2016-04-07T18:49:16.000112Z

@arrdem: or maybe even make supportsMeta test hasMeta || hasPrimSigs

bronsa 2016-04-07T18:49:34.000113Z

that's the only case where that makes a difference

bronsa 2016-04-07T18:50:46.000114Z

or not, if you want to avoid forcing the applyTo path I guess

arrdem 2016-04-07T18:50:56.000115Z

Eh. I'm content to hard code supportsMeta true, right and avoid the applyTo path.

arrdem 2016-04-07T18:51:20.000116Z

Two line change and a bunch of deletions. Best kinda patch.

bronsa 2016-04-07T18:54:31.000118Z

downside is every fn is now ~300bytes heavier

arrdem 2016-04-07T18:58:05.000119Z

Not even...

arrdem 2016-04-07T18:58:47.000121Z

Derp. I didn't read carefully. You were dead on.

arrdem 2016-04-07T18:59:40.000122Z

Eh. The price of sanity. I'm willing to pay it and after all this is my sandbox 😛