On Jul 16, 11:50 pm, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> 2009/7/17 Mark Addleman <mark_addle...@bigfoot.com>
>
>
>
> > "The "sufficiently smart compiler" argument
> >  comes to mind: if the arglist of a function is known, then surely
> > the
> >  compiler should be able to automatically translate named/keyword
> >  arguments into an appropriate simple call?"
>
> > That is exactly what motivated me to write this macro.  I was pretty
> > sure keyword args could be optimized to exactly the same as positional
> > arguments without much difficulty (although this macro took me an
> > embarrassingly long time to write!).  I wish there was a way to hook
> > the reader so that the macro could be called implicitly.  It seems
> > that the metadata facility would be a perfect solution to this.  If I
> > tag some symbol with metadata {:interpreter named-call}, for example,
> > the reader should delegate to the macro named-call.
>
> Not so easy I think, even if you had that.
>
> How would the hooked-under-the-hoods named-call macro distinguish between
> this call (some-fn :a :b :c :d) (regular call of some-fn body defined for
> arity = 4) from (some-fn :a :b :c :d) (regular call of some-fn body with
> named arguments, for arity = 2) if some-fn is defined for arities 2 and 4 ?

I guess I had in mind some kind of chaining mechanism.  Suppose named-
call returned the function symbol (followed by the arguments) where
the symbol did not contain the {:interpreter named-call} meta-data.
Then, there is no ambiguity.  In both of your examples, the reader
would apply named-call to some-fn+args and named-call would assume
that the args are name value pairs.

I think there are other (perhaps better) algorithms for chaining.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to