From: | Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com> |
Newsgroups: | comp.compilers |
Date: | Thu, 07 Jun 2012 18:15:58 +0000 |
Organization: | A noiseless patient Spider |
References: | 12-03-019 12-03-026 12-03-029 |
Keywords: | design, comment |
Posted-Date: | 08 Jun 2012 17:24:29 EDT |
Hans Aberg <haberg-news@telia.com> writes:
> On 2012/03/12 06:49, glen herrmannsfeldt wrote:
>
>> As I understand it, Fortran introduced the multi-character variable
>> name, pretty much universal in programming languages, but
>> mathematicians haven't caught on yet.
Mathematicians have an implied operator between symbols. You can't do
that with multi character names. Not in a way that can make sense, to
me.
Operator overloading, if done incorrectly, is a maintenance nightmare so
I don't think there will ever be a language with user defined implied
operators.
%let * be the implied operator
Then one could write
K = a b + c^2 a k;
which would mean
K = a * b + c^2 * a * k;
where ^ is "to the power of" and +, * the usual mathematical operators.
And while I find it easier to read the former, I doubt it'll be
universally recieved since slightly later in the program one might
encounter
%let ^ be the implied operator
L = c 2;
and L is suddenly c squared.
Maybe I'll try a toy language with implied operators one day.
--
Johann Oskarsson http://www.2ndquadrant.com/ |[]
PostgreSQL Development, 24x7 Support, Training and Services --+--
|
Blog: http://my.opera.com/myrkraverk/blog/
[It's been done. Probably before you were born. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.