Flea Wong <[email protected]> writes:

Hi!

I'll take the third question first:

> 3.  Why the different function call "subtotal" (*without* Dot, see
> Apple) vs ".subtotal" (*with* Dot, see Orange) for extend-type vs
> inline implementation of Fruit?

You should always use (subtotal fruit).  That with an inline
implementation which is backed by some generated interface there is a
.subtotal method is a pure implementation detail you shouldn't rely on.
I.e., (.subtotal fruit) is no function call but a Java interop method
call.

> 1.  Why *doesn't* extend-type (see Banana) work when implementing
> protocol Fruit in a different namespace

It does work, but since Banana doesn't extend Fruit inline, the
corresponding Fruit interface has no .subtotal method, so you cannot
call it using (.subtotal banana) but (subtotal banana) will work.

> 2.  Why *does* inline implementation (see Apple) work when
> implementing protocol Fruit in a different namespace

Calling (.subtotal apple) works, because it's implemented inline and so
the corresponding interface has that method and you can call it using
Java interop which (.subtotal apple) is.

Bye,
Tassilo

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to