>
> I'm not looking for a way to statically define protocols in which
> classes participate. Consider an example similar to the one I gave in
> my reply to Laurent:


Static defining of anything is just a matter of chose, especially in
Clojure.  For example in Spinoza you have pose-as which changes the class of
an object. The primary purpose of Spinoza is structural inheritance and
basic dispatch on type, but I've been thinking about runtime modification
and your post gives me a lot of ideas.


> (make-thing {:models [::vehicle ::airborne]
>                    :protocols [::thing ::idea]
>                   :inits {:name "test-thing1" :number 1}})
>

Something like this would be quite simple to build on top of Spinoza.  Also
allowing protocols to be defined at class definition time and runtime would
work the same way that pose-as works

(adopt-protocol obj ::some-protocol ::another-protocol)


> Note that no classes are involved. The thing in question is not an
> instance of any class (except incidentallly, by virtue of the fact
> that Clojure's runtime is built on the JVM). I never defined any
> classes, nor did I wish to. A class definition would have been just an
> obstacle, not directly relevant to my goal, which was to instantiate
> an object that reflects these models and participates in these
> protocols.


As I'm alluding above, this direction seems prototypal, and I've been
thinking about allowing for these kind of behaviors in Spinoza.

Of course no collaboration beyond healthy discussion is expected.  Thanks
for bringing the topic up again :)

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