Adding print-style function calls, and preproc plugins

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Fri Aug 31 13:09:17 EDT 2001


Thu, 30 Aug 2001 12:20:56 -0400 (EDT), Steven D. Majewski <sdm7g at Virginia.EDU> pisze:

> It's extremely ambiguous. 
> 
> What does:
> 	"e1 e2 e3 e4 e5" 
> mean when more than one of those e's is a function ? 
> Can you tell which ones represent function calls if you don't
> know the value of all of the e's ? 

I'm experimenting with a syntax with parenthesesless function calls for
another language. It works and it's self-consistent, doesn't require
context-dependent parsing or semantic translation, but I had to pay
with the following:

- Calling a function returned by a function or held in a variable
  requires a different syntax than calling a plain named function.
  There is an explicit "call" operator there.

- Passing a plain named function as an argument requires a different
  syntax than passing an object returned by a function or held in
  a variable. There is an explicit "reference" operator there (the
  same operator is a restricted variant of "lambda").

This is done by having two mutually recursive "levels" of semantics
of object-like things: identifiers are bound to functions and
expressions denote functions, functions return objects, objects
may denote functions.

Reading a variable is unified with calling a function (a variable
name denotes a function which, when called without parameters,
returns the current value of the variable).

In this language "e1 e2 e3 e4 e5" means calling function e1 with
arguments e2..e5. Unless e1 does something special, the functions
e2..e5 are called once (which boils down to reading their values
in case they are really variables).

I don't know how to dress this language with Python-like function
call syntax or vice versa. Semantic splitting of functions/objects
requires syntactic support and vice versa.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list