[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Document what's allowed in function names

From: Stephane CHAZELAS
Subject: Re: Document what's allowed in function names
Date: Wed, 25 May 2011 17:20:49 +0100
User-agent: Mutt/1.5.16 (2007-09-19)

2011-05-24 17:23:20 -0400, Chet Ramey:
> > Why would you put any restriction on the allowed name of a function?
> Because Posix does, and because unset without -f has to enforce the variable
> name restrictions.  (Though the language has been relaxed in the latest
> standard.)

POSIX puts restrictions on the name of functions used by
applications, but I can't see anywhere it restricting what the
shell allows.

'foo bar'() {

being not a valid POSIX syntax, I can't imaging POSIX forcing a
shell to do this (define a "foo bar" function) or that (return
an error message) upon reading it.

I may be wrong though, is there any specific section of the
standard you had in mind?

Note that all of pdksh, mksh, zsh (at least) allow
foo+bar() { w; } for instance
ksh93 allows foo.get() { w; }

I also find it unfortunate that bash doesn't allow

foo() bar

given that every other Bourne-like shell (including the Bourne
shell) supports it (again, it's not POSIX syntax, so bash
doesn't have to implement it, 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]