Infix Operators (Re: March 22/23 notes)

Claus Reinke claus.reinke at talk21.com
Fri Mar 25 14:18:20 PDT 2011


Hi Dave, 

> Interesting idea; I'd never considered lifting some of these 
> good syntax ideas from Haskell before.

thanks. Yes, I've often noticed that people equate Haskell 
language design with its advanced type system ideas, while
the much more stable ideas (such as reducing syntactic
noise) in the base language tend to get overlooked. 

Yet the quality of the base language design is a major 
contributing factor in making advanced design ideas 
thinkable and implementable, without being afraid of 
getting mired in unrelated issues.
 
> One issue with the Haskell `...` syntax directly is conflict with 
> the quasi-literals proposal, but we can think about alternatives 
> offline (let's *not* get into a discussion of concrete syntax 
> here on the list -- those never go well here).

Thanks for elaborating - the first comments that said "not
on this list, please" without explaining why were confusing
to me!-) Perhaps the nature/acceptable levels of suggestions
for this list could be hinted at on the list summary page?

At this stage, I'm more concerned with the general ideas 
anyway: solving infix ops once and for all, instead of one 
by one, and making sure that conversions between infix 
and prefix are supported.

What that looks like in Javascript may be quite different
from what it looks like in Haskell. The solution has to fit
the language.
 
> Also, in principle I like the idea of borrowing Haskell's 
> partial operator application syntax, but it doesn't work 
> with operators like + and -, since those are also already 
> valid unary prefix operators. 

Haskell happens to have a unary prefix minus, and using
the same symbol for infix and prefix op has turned out to 
be a well-meant, but troublesome idea..

#-functions might make inline functions nearly as light-
weight as in Haskell, it is just worth keeping in mind that
a functional language has a lot of infrastructure that 
expects (prefix/first-class) functions, so if infix ops are
a piece of syntax, there's going to be a compatibility issue.

> But speaking for myself anyway, I'll chew on the idea. 
> Thanks for bringing it up!

Thanks for listening, and letting me know!-)

Claus

 


More information about the es-discuss mailing list