Mars0i <marsh...@logical.net> writes:

> Is the following correct?
>
> The only way to define *multiple* mutable instance variables/fields
> for a class visible in Java is by using deftype with :volatile-mutable
> or :unsynchronized-mutable.  The only way to inherit from a concrete
> Java class is by using gen-class or proxy.  gen-class allows a single
> mutable field using :state and :init.  Thus there is no way to define
> a class that both inherits from a concrete class and defines more than
> one new instance variable.

I think that's correct (with the exception you already mention yourself:
you can use a :state structure containing multiple values).

> I know that I can use gen-class's state variable to hold multiple
> mutable structures by putting e.g. atoms inside of a map or record
> stored in the state variable, or by storing a deftype instance with
> mutable fields in the state variable.

If you care mostly about performance, maybe using an array as :state
will do.  That's always mutable and access is really fast.

Other than that, I agree with Marshall that Java is a solid DSL for
writing Java classes.

Bye,
Tassilo

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to