[racket-dev] New error messages for *SL

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Jul 12 08:45:01 EDT 2011

At Mon, 11 Jul 2011 18:28:56 -0400, Guillaume Marceau wrote:
> On Thu, Jul 7, 2011 at 12:44 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> > * ASL incorrectly specifies >= 1 arguments required for functions and
> >   function calls (i.e., functions and call are not common syntax at
> >   that point).
> >
> 
> Stephen pointed out that function calls in BSL can invoke functions of
> zero arguments. You can't define such a function, but if you get it
> from a library, it works fine.
> 
> Should I document the grammar for function calls as (name expression
> ...) thorough?

My initial reaction was that a 0-ary function call is a syntax error,
but a teachpack might extend the grammar by introducing a binding that
works without arguments. That is, the 0-ary extension is part of the
teachpack, not the grammar.

But it seems that 0-ary function calls are not syntax errors after all
(in any Recent version of DrRacket). For example, BSL accepts

 (define (f x)
   (cons))

and complain only when `f' is called. I'm not sure whether it's better
to try to fix that or leave it alone (maybe it's not causing any
trouble) and adapt the grammar somehow.

I write "somehow" because calling a (not pre-)defined function with 0
argument is a syntax error. For example, BSL rejects

 (define (f x)
   (f))

as a syntax error.




Posted on the dev mailing list.