why not multimethods?

Saludos,
Nahuel Greco.


On Fri, Aug 22, 2014 at 1:30 PM, Laurens Van Houtven <[email protected]> wrote:

> Hi Clojurers,
>
>
> I'm writing a capability system with Clojure. Make a request to a URL, it
> grabs the "plan" for what it should do from the database. A plan consists
> (eventually) of atomic "steps". Typical example of a step would be "make an
> HTTP request", represented by a map like {:type :http :url "
> http://www.example.test"; :method "GET"}.
>
> I would like to allow people to implement different types of steps (http,
> delays, e-mail, ftp...), ideally by modifying as little existing code as
> possible. Step implementations have two parts:
>
> - a step handler (better name suggestions welcome...): a function that
> takes a step map of the appropriate type, producing a channel that will
> eventually have a result posted on it and be closed
> - a step schema (a prismatic/schema schema), describing the step map.
>
> Right now I manage both of these manually. That works fine, because the
> only thing I've implemented so far is HTTP requests ;-)
>
> I briefly considered protocols for this; perhaps a protocol with a handler
> fn and the schema, but AFAIK protocols only know about their extenders, not
> so much about their implementations. (Even with manual registration, a
> protocol may still be an appropriate tool.) Plus, that wouldn't solve the
> problem of dispatching based on type (i.e., given a map like the example
> above, find the handler function that can do something with it).
>
> This project is in its earliest stages, so I am very eager to hear about
> wildly different suggestions as well :)
>
>
> thanks in advance
> lvh
>
> --
> 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.
>

-- 
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