On Wed, Mar 23, 2011 at 3:43 AM, Jules <jules.gosn...@gmail.com> wrote:
> I only have a brief posting window this morning (I have to leave for
> work) so have not researched this as well as I should before coming to
> the list - so please forgive if this is a bit lame...
>
> Should I still be using gen-class to achieve link time compatibility
> with Java ?
>
> If so, why am I constrained to using a single field to hold my state
> (.state) ? (or have I missed something?).
>
> I am finding that all my gen-class-ed types need to define themselves,
> as well as a structure for their immutable parts and a structure for
> their mutable parts. Every method invocation involves at least two
> lookups one to fetch the immutable part from the .state field and one
> to lookup some useful piece of data in it.
>
> I'd like to reduce this to one lookup, directly into an immutable
> field in the POJO.

If you're implementing an interface, you can use deftype to create
objects with multiple mutable and immutable fields and with methods
corresponding to that interface.

And you can use definterface to make an interface. You don't even have
to call the objects via the interface. :)

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