Hi Everyone,

I have a question about an apparent redundancy in clojure's generated
class files. Out of curiosity I was inspecting the core class files
using the Java Decompiler JD-GUI. For example, here is the decompiled
version of core$dec.class (the implementation of the dec function):

package clojure;

import clojure.lang.AFunction;
import clojure.lang.IObj;
import clojure.lang.IPersistentMap;
import clojure.lang.Numbers;

public final class core$dec extends AFunction
{
  final IPersistentMap __meta;

  public core$dec(IPersistentMap paramIPersistentMap)
  {
    this.__meta = paramIPersistentMap; }
  public core$dec() { this(null); }
  public IPersistentMap meta() { return this.__meta; }
  public IObj withMeta(IPersistentMap paramIPersistentMap) { return
new dec(paramIPersistentMap); }
  public Object invoke(Object x) throws Exception { x = null; return
Numbers.dec(x);
  }
}

I noticed that every class file, corresponding to a function in the
core, contains many of these same lines for implementing metadata
storage, namely:

import clojure.lang.IObj;
import clojure.lang.IPersistentMap;

  final IPersistentMap __meta;
  public core$FUNCTIONNAME(IPersistentMap paramIPersistentMap)
  {
    this.__meta = paramIPersistentMap; }
  public core$FUNCTIONNAME() { this(null); }
  public IPersistentMap meta() { return this.__meta; }
  public IObj withMeta(IPersistentMap paramIPersistentMap) { return
new FUNCTIONNAME(paramIPersistentMap); }

It seems to me that this metadata storage functionality could be
absorbed into the relevant abstract class(es), perhaps AFn.

Could this change increase performance and cut down on the size of the
bytecode?

Best regards,
Arthur

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to