Operators for everything (was Re: Operators for matrix)
Michael Hudson
mwh21 at cam.ac.uk
Fri Jul 21 14:18:44 EDT 2000
W.Whiten at mailbox.uq.edu.au (Bill Whiten) writes:
> In article <3977AF5E.552F4F42 at my.signature>, Greg Ewing <see at my.signature>
> wrote:
> > Python with its overloadable operators can be thought of
> > as a meta-language for creating domain-specific languages.
> > But the number of operators is too restricted for it to
> > be really good in this role. Operator overloading feels like
> > something tacked on as an afterthought rather than a
> > serious feature. I don't think it's unreasonable
> > to consider whether this situation could be improved.
>
> I would prefer the normal oprerators plus an escape character followed by
> additional characters to define new operators eg @+ @div etc.
I quite like this idea (unlike most of the others that have been
mentioned...); it reminds me of Haskell.
The semantics would be:
a @<id> b === <id>(a,b)
for any valid identifier <id>.
There are still precedence issues, but I think they can be ignored
(make everything of this from the same (low) precedence & left
asssociative).
Cheers,
M.
--
3. Syntactic sugar causes cancer of the semicolon.
-- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html
More information about the Python-list
mailing list