Hi,

Thanks for your feedback on your RxJava usage. I'm glad to hear that
neither of you feel too strongly about direct IFn support because...
In an effort to simplify the implementation and improve the RxJava
experience for all JVM-based languages, we'll be dropping direct IFn
support (and Groovy closure, Ruby proc, etc) in the next release. Instead,
for each supported language (Scala, Groovy, and Clojure at the moment),
we'll be providing a set of utility functions/macros/implicits to assist
with interop. In the Clojure case, this will consist of a namespace,
probably rx.lang.clojure, with the following helpers:

  (defn fn* [f])   Takes a function f, and wraps it in an object that
implements all the various Rx FuncX interfaces

  (defmacro fn [& body])    Makes an "anonymous" Rx FuncX object with body
(multi-arities and everything from clojure.core/fn are supported)


So usage would basically be as I noted in my message above:

(require '[rx.lang.clojure :as rx])

(-> my-observable
    (.map (rx/fn [v] (Long/parseLong v)))
    (.reduce (rx/fn* +)))

A similar function/macro pair will be provided for the Rx ActionX
interfaces for which there's currently no direct support.

This will provide us with base Clojure interop support which is slightly
more tedious to use than before. In the longer term, we'll be releasing a
more expansive, idiomatic set of Clojure bindings. We're not quite there on
that one though.

If anyone knows any reason this should not happen, speak now or forever
hold your peace.

Cheers,

Dave





On Wed, Aug 28, 2013 at 2:32 AM, Joseph Wilk <j...@josephwilk.net> wrote:

> On Tuesday, August 27, 2013 6:03:29 PM UTC+2, daveray wrote:
>
>> Hi.
>>
>> I'm writing to see if there's anyone out there using RxJava [1] from
>> Clojure and to get their opinion on it's current, built-in support for
>> non-Java languages.
>>
>> Just to recap, the current implementation knows about clojure.lang.IFn
>> allowing functions to be passed directly to RxJava methods:
>>
>>   (-> my-observable
>>     (.map (fn [v] (Long/parseLong v)))
>>     (.reduce +))
>>
>> RxJava will automatically convert these functions to the underlying
>> rx.util.functions.FuncX interface and re-dispatch to the appropriate method.
>>
>> So, the question is: as a user of RxJava, how valuable is this feature?
>> Do you just end up wrapping things anyway,
>>
>
>
> We are using RxJava and Hystrix with Clojure @ SoundCloud. All our
> Observables come from Hystrix cmds.
>
> I've have not added any wrappers around the RxJava stuff yet, not really
> felt the need.
> I've found it convenient to pass in fns but I would also be happy with
> what you suggest below (rx/fn).
> I suspect in those cases I might start wrapping rx/fn, so it continues to
> look like the current behaviour (recognising Clojure fns).
>
> Thanks,
> --
> Joseph Wilk
> http://blog.josephwilk.net
> @josephwilk
>
>
>
>> so you could easily perform the same transformation in your wrapper?
>> Would helper fns/macros be a sufficient alternative:
>>
>>   (-> my-observable
>>     (.map (rx/fn [v] (Long/parseLong v)))
>>     (.reduce (rx/fn* +)))
>>
>> There will be some changes in this area in the near future and we'd like
>> to get a feel for if/how people are using RxJava from Clojure.
>>
>
>
>>
>> Thanks!
>>
>> Dave
>>
>> [1] https://github.com/Netflix/**RxJava<https://github.com/Netflix/RxJava>
>>
>  --
> --
> 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
> Note that posts from new members are moderated - please be patient with
> your first post.
> 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
> ---
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to