Hi all:

Shady is intended to be a collection of JVM interop facilities.  Right
now it contains two useful pieces of functionality for producing iterop
classes: a version of `gen-class` supporting dynamic redefinition like
`deftype`; and a `defclass` macro providing a `deftype`-like interface
to that `gen-class`.

For example:

    (ns example.defclass
      (:use [shady.defclass :only [defclass]]))
    
    (defclass Example [field1 field2]
      :extend BaseClass
      :constructors {[String String] [String]}
    
      Example
      (-init [arg1 arg2] [[arg1] [arg1 arg2]])
      (newMethod ^String [^int param]
        (str "example:" field1 ":" param ":" field2))
    
      BaseClass
      (override ^Long [^Class class] 10)
    
      SomeInterface
      (implementedMethod []
        "Types defaulting to Object, as you'd hope."))

The interface is cleaner (IMHO), and normalized with the other Clojure
type-definition facilities.  The support for dynamic class redefinition
is clinically proven to produce 73% less heartache for interop
situations where you need full JVM classes.  Be warned though, under the
hood `defclass` does still use the same class-generation code as
`gen-class`, with all that implies (performance, methods backed by
functions bound to vars in the implementing namespace, etc).

You can get the source from github:

    https://github.com/llasram/shady

And the jar from Clojars:

    [shady "0.1.0"]

This is the first Clojure library I'm pushing for broader consumption,
so feedback is more than welcome.

-Marshall

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