Why not use juxtaposition to indicate function application

Terry Reedy tjreedy at udel.edu
Sat Mar 17 05:38:27 CET 2012


On 3/16/2012 9:14 AM, bruno.desthuilliers at gmail.com wrote:
> On Mar 16, 1:45 pm, Ray Song<emacs... at gmail.com>  wrote:
>> I confess i've indulged in Haskell and found
>>      f a
>> more readable than
>>      f(a)
>
> Hmmm... What about:
>
>      f a b
>
> versus
>
>      f(a(b))
>
> or was it supposed to be read as
>
>      f(a)(b)
>
>
> or as
>
>     f(a, b)
>
> ?-)

One also has to consider Python calls with *args, **kwds, and arg=obj. 
These are all compile-time SyntaxErrors unless inside parens that follow 
a expression.

Also, function calls, especially in a functional language without 
side-effects, do not usually occur in isolation.
'f(a) + 3' would have to be written as '(f a) + 3', so saving of parens 
anyway.

Also, is 'f a - 2' f(a -2) or f(a, -2)? A new precedence rule is needed 
to disambiguage.

-- 
Terry Jan Reedy




More information about the Python-list mailing list