Sorry - just noticed the "Re: cljs: extend-protocol to Keyword" discussion of a
few days ago.
Maybe we should start maintaining an FAQ-like wiki-page with summaries of those
issues/features…
-FS.
On Nov 30, 2012, at 5:17 PM, Frank Siebenlist
wrote:
> When I ask for the type of a keyword, s
When I ask for the type of a keyword, symbol or string, cljs gives me the same
answer:
---
ClojureScript:cljs.user> (type "jaja")
#
ClojureScript:cljs.user> (type 'jaja)
#
ClojureScript:cljs.user> (type :jaja)
#
ClojureScript:cljs.user> (= (type :jaja)(type 'jaja)(type "jaja"))
true
---
but the
On Fri, May 20, 2011 at 2:54 AM, Ken Wesson wrote:
> => (def r (put (DateMap. {}) :foo (java.util.Date.)))
> #'user/r
> => r
> {:foo "Thu May 19 22:44:37 PDT 2011"}
> => (get-as-date r :foo)
> #
Bah, copy and paste error. Test it and you'll find it works
regardless. Somehow I got the result from
On Thu, May 19, 2011 at 11:26 PM, Lachlan wrote:
> Just working through this, if we take your example above, what if I
> wanted to override the 'put' method rather than define a new one,
> since we don't have access to 'proxy-super'. For example making a map
> that enforces storage of dates in a
Hi Ken,
I hadn't thought of using explicit metadata for this purpose, I guess
I was thinking that the class of the object would determine what it
could do.
Just working through this, if we take your example above, what if I
wanted to override the 'put' method rather than define a new one,
since w
On Wed, May 18, 2011 at 7:19 PM, Lachlan wrote:
> A further example of this proxy method not working would be trying to
> add methods to a clojure.lang.PersistentVector. It doesn't seem to
> have an ??
=> (seq (.getConstructors (type [])))
nil
PersistentVector lacks public constructors.
=> (f
On 19 May 2011 01:55, David Nolen wrote:
> On Tue, May 17, 2011 at 5:52 PM, jlk wrote:
>>
>> (proxy2 [String]
>> AProtocol?
>> (theseBehaveAsStringsWithThisAdded [] ...)
>>
>> leaving regular Strings unaffected?
>
> The problem is that Java is inherently and early-bound design. It's
> difficult
On Tue, May 17, 2011 at 5:52 PM, jlk wrote:
> (proxy2 [String]
> AProtocol?
> (theseBehaveAsStringsWithThisAdded [] ...)
>
> leaving regular Strings unaffected?
The problem is that Java is inherently and early-bound design. It's
difficult to do efficient composition a la Objective-C where you
My interpretation of the questions was that "String" was only an example.
Regardless of what the question actually was, I felt that some clarifying of
"proxy" would be appropriate.
Jonathan
On Wed, May 18, 2011 at 4:52 PM, Ken Wesson wrote:
> On Wed, May 18, 2011 at 10:40 AM, Jonathan Fischer F
On Wed, May 18, 2011 at 10:40 AM, Jonathan Fischer Friberg
wrote:
> If I'm not mistaken, you should NOT use extend-type to extend java classes
> (only interfaces and protocols).
>
> To answer your questions, you can "extend" a class and interfaces with
> proxy, like so:
>
> (proxy [classA interfac
If I'm not mistaken, you should NOT use extend-type to extend java classes
(only interfaces and protocols).
To answer your questions, you can "extend" a class and interfaces with
proxy, like so:
(proxy [classA interfaceA interfaceB] [] ...)
Note that you cannot use protocols directly, you can ho
On Tue, May 17, 2011 at 5:52 PM, jlk wrote:
> Hello
>
> Apologies if I'm misunderstanding something here, but is it possible
> to easily extend to a new java type? For example:
>
> proxy -> allows you to implement methods that are already defined in
> an interface or class, so you can redefine me
Hello
Apologies if I'm misunderstanding something here, but is it possible
to easily extend to a new java type? For example:
proxy -> allows you to implement methods that are already defined in
an interface or class, so you can redefine methods
(proxy [ClassA] []
(thisMustBeDefinedInClassA [] .
13 matches
Mail list logo