Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macro for remote functions #12

Open
Licenser opened this issue Dec 3, 2011 · 3 comments
Open

macro for remote functions #12

Licenser opened this issue Dec 3, 2011 · 3 comments

Comments

@Licenser
Copy link

Licenser commented Dec 3, 2011

(defremote my-remote-function)
;-> (non working theory code:(
(defn my-remote-function [& args]
  (remote (my-remote-function args) [res]
    res))

as a simple way to declare remote functions to call :)

@ibdknox
Copy link
Owner

ibdknox commented Dec 4, 2011

Can you explain a bit more of what you mean? I'm not sure I understand what you're asking :) (defremote ..) already declares a function that you can use anywhere you want.

(defremote my-func [] (println "cool"))
(my-func)

@Licenser
Copy link
Author

Licenser commented Dec 5, 2011

oh sorry, I kind of didn't say what I wanted to say. I was talking about the remote (cljs) side. Currently you have to use letrm or remote to get the results of a remote fn, it would be great if I could declare a function as a remote function and then use it normaly in my cljs code:

;; Server side
(defremote adder [a b] 
(+ a b))

;; Client Side (cljs) / defremote was a absolutely stupid pick from me since it is taken already ;)
(declare-remote adder)

(adder 1 1)

I noticed that a problem was that no code highlight ate some of the stuff I wrote :)

@Licenser
Copy link
Author

Licenser commented Dec 6, 2011

I understand why this isn't done, the closure library is handling things entirely asynchronous for a function to return things a synchronous way would be needed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants