On Mon, May 15, 2017 at 1:22 AM, Per Bothner <xxxxxx@bothner.com> wrote:

Why would anyone ever want to use fx+ *except* in a procedure call?

I think an obvious candidate would be:

(s16-vector-map fx+ a-long-vector-of-shorts another-long-vector-of-shorts)

where you want to eliminate the dispatch overhead of + on a system without type inference.

I've been thinking more and more and I think (contrary to my general preference for conservative, particularizing solutions) that what we need for operations like fx+ is Common Lisp's define-compiler-macro.  This allows the user to declare a syntax keyword for an identifier that already has an ordinary definition.  In keyword position, the macro is used; in any other position, the variable is used.  This basically allows users to write their own compiler optimizations.

After brainstorming with a cow orker, we like the name "define-overloaded-syntax".  I don't think it's necessary to have local versions of this, but I don't object to having them.

Comments?

-- 
John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
How they ever reached any conclusion at all is starkly unknowable
to the human mind.        --"Backstage Lensman", Randall Garrett