2010/11/5 ka :
> static public ISeq seq(Object coll){
> if(coll instanceof ASeq)
> return (ASeq) coll;
> else if(coll instanceof LazySeq)
> return ((LazySeq) coll).seq();
> else
> return seqFrom(coll);
> }
>
> @Laurent,
>> * first, when I see calls to (instance?) (satisifies?), it rings
Hi,
On 5 Nov., 03:17, ka wrote:
> Yes Meikel that is exactly what I have right now. Just trying to learn
> and stir up a discussion here :)
And it's a good discussion. I think many in the community - myself
included! - don't grok protocols, yet. So any discussion on how they
are intended to be
On Thu, Nov 4, 2010 at 10:17 PM, ka wrote:
> > May I ask a heretic question: Why don't you specify the contract in the
> docstring of the protocol?
>
> (defprotocol Coolness
> "Yadddayaddablablablubber.
> Cool things have to be Comparable and Serializable."
> (x .. "Since 'this' is cool i ass
> May I ask a heretic question: Why don't you specify the contract in the
> docstring of the protocol?
Yes Meikel that is exactly what I have right now. Just trying to learn
and stir up a discussion here :)
Most times you'll just do fine by passing 'something' to Coolness
functions and expect th
Hi,
On 4 Nov., 08:50, Paul Hobbs wrote:
> Strong type systems make programming in the large easier. It would be nice
> if I didn't have to walk on eggshells when using a library. Written
> agreements are also known as "gotchas".
I'm not sure what you mean with "strong" type systems. Clojure's
On Thu, 4 Nov 2010 00:50:35 -0700
Paul Hobbs wrote:
> Strong type systems make programming in the large easier.
Paul,
"Strong typing" has so many definitions that your statement is nearly
meaningless. See http://www.wordiq.com/definition/Strong_typing for a
few.
Now, if you have some prove t
Well,
I'm not totally sure about what I'll write below, but I'll still try
to make a decent job of sharing my current thoughts:
* first, when I see calls to (instance?) (satisifies?), it rings a
bell in my head. "design problem".
* second, it seems like you're trying to "fix in the concrete"
Meikel,
Strong type systems make programming in the large easier. It would be nice
if I didn't have to walk on eggshells when using a library. Written
agreements are also known as "gotchas".
--
Paul Hobbs
On Wed, Nov 3, 2010 at 11:30 PM, Meikel Brandmeyer wrote:
> Hi,
>
> On 4 Nov., 04:58,
For complex cases, you may like to fall back on multi-methods and
abstraction types. I blogged about typed abstractions few days ago
here:
http://bitumenframework.blogspot.com/2010/10/typed-abstractions-in-clojure.html
Regards,
Shantanu
On Nov 4, 1:25 pm, "nicolas.o...@gmail.com"
wrote:
> I see
I see your point.
Somehow, it is annoying to have to manipulate a set of protocols that
always go together.
And it would be nice to have a shorthand.
I have a very small prototype here:
git://nicolasoury.repositoryhosting.com/nicolasoury/type-classes.git
of some code to allow "type-classes" like
Hi,
On 4 Nov., 04:58, ka wrote:
> (defprotocol OnlyHalfCooless x y z)
>
> Instead of
> (defn is-this-cool? [o] (satisfies? Coolness o))
>
> I need to now write:
> (defn is-this-cool? [o] (or (instance? Cool1 o) (instance? Cool2 o))
> or, (even worse)
> (defn is-this-cool? [o] (and (satisfies? On
> AFAIK, it is not possible. You must implement all the different protocols.
> It might look desapointing, but on the other hand it is not necessary.
> (As there is no static typing in Clojure)
> What is your use-case?
Current use case is that I want an abstraction which comprises of a
set of oper
On Wed, Nov 3, 2010 at 5:37 AM, Stuart Sierra
wrote:
> Protocols provide just one thing: polymorphic functions. They are not
> intended to provide "type" or hierarchy like Java classes /
> interfaces.
Well, they also provide a second thing -- a way to bundle multiple
functions as something that i
On Nov 3, 6:32 am, ka wrote:
> 1. How to combine protocols?
Just define types that extend all the protocols.
> On a related note if I have a protocol P how can I create a protocol
> with is a union of P and java.lang.Comparable ?
You can't. But you can define a type that extends both P and
Com
On Wed, Nov 3, 2010 at 10:32 AM, ka wrote:
> 1. How to combine protocols?
>
AFAIK, it is not possible. You must implement all the different protocols.
It might look desapointing, but on the other hand it is not necessary.
(As there is no static typing in Clojure)
What is your use-case?
> 2. Do
15 matches
Mail list logo