Hi,
may I throw in ye olde hierarchies?
(deftype MySpecialType)
(extend-type MySpecialType
Foo
...
Bar
...)
(derive MySpecialType ::FooBar)
(defn instance-of?
[c x]
(isa? (type x) c))
(instance-of? (MySpecialType.) ::FooBar) = true
Maybe a bit clumsy, but to me it feels cleaner
Um, this is all going down a path that I don't propose to follow. I am
manifestly aware that there are loads of alternatives already in Clojure
(and Java, for that matter), and many reasons both theoretical and practical
for doing or not doing all manner of things. But, a couple of remarks:
Clojure uses marker interfaces. ClojureScript supports marker protocols.
I don't see why Clojure shouldn't support this.
David
On Wed, Oct 5, 2011 at 3:36 PM, hgreen hhgr...@ieee.org wrote:
Um, this is all going down a path that I don't propose to follow. I am
manifestly aware that there are
I'd recommend that you file a bug; surely that's a regression.
As you pointed out, this fails:
user= (defprotocol xyz)
CompilerException java.lang.UnsupportedOperationException: Unknown
Collection type, compiling:(NO_SOURCE_PATH:1)
But the expansion works if you evaluate it directly, which might
I finally got around to trying out the 1.3 release yesterday with a batch of
code that was constructed using 1.2, and promptly ran into a problem. In
1.2, it's possible to define a protocol with zero methods, so, for example,
(defprotocol
xxx) works just fine. In 1.3, this generates the rather
I finally got around to trying out the 1.3 release yesterday with a batch of
code that was constructed using 1.2, and promptly ran into a problem. In 1.2,
it's possible to define a protocol with zero methods, so, for example,
(defprotocol xxx) works just fine. In 1.3, this generates the
Somehow, I just knew someone was going ask why...? :-)
A while back, I constructed a little mechanism for defining data types,
built on top of the protocol/record/type mechanism. Under certain
circumstances, it generates protocols with no methods, basically in
situations where it wants to
On Oct 4, 2011, at 7:40 PM, hgreen wrote:
Somehow, I just knew someone was going ask why...? :-)
:-)
A while back, I constructed a little mechanism for defining data types, built
on top of the protocol/record/type mechanism. Under certain circumstances, it
generates protocols with no
Marker interface is the right idea (and I did in fact look it up in
Wikipedia last night :-)), but I was trying to avoid saying that. What my
stuff is doing is arguably a little different: a Java analogy would be
something like defining a new interface that's a composite of several other
Doesn't java have kinda-sorta union types now? Like, you could declare
a method as:
public T extends Closeable Serializable void serializeAndClose(T
thing) {...}
It seems like marker interfaces are no longer necessary for this sort
of thing. Likewise in Clojure, instead of having a
10 matches
Mail list logo