[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unset does not remove functions like a[b] unless -f is specified
From: |
Chet Ramey |
Subject: |
Re: unset does not remove functions like a[b] unless -f is specified |
Date: |
Fri, 3 Feb 2023 21:11:23 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 |
On 2/3/23 6:55 PM, Robert Elz wrote:
| However, bash allows,
| and has always allowed, function names to contain slashes when running in
| default mode. This has been true for over 30 years.
I never knew that, and I've been using bash probably all of that time.
OK.
| It's kind of redundant, since POSIX doesn't allow the application to have
| function names that contain slashes in the first place.
Well, kind of - a portable application cannot assume that function names
that are not "name"s will work - but the shell is allowed to support more
than that:
An implementation may allow other characters in a function name
as an extension.
and if the application knows that the implementation permits it,
Sure. There's just no portable way to find out. You have to rely on extra-
standard mechanisms.
But a posix conforming shell will still never execute a function that
has a '/' in its name, even if it has extended the character set for
function names, and allows '/' in that set.
Yep. I'll probably change that.
| Earlier versions of the standard required the function name to be a NAME,
| while acknowledging extensions were possible.
It still does.
In a different way. The original versions offered no wiggle room: "fname
... shall be a name." Post-2001 versions shifted the burden: "the
application shall ensure that it is a name." Implementations could offer
other characters, but the standard in place when I added posix mode
required a function name to be a name, so that's what bash enforced. This
is 1992 or thereabouts, remember.
The point of all of this is that if all shells started adopting a MUCH
wider character set for function names, perhaps the next revision of the
standard (not the one coming next year or whenever - but the one after
that, Issue 9, perhaps in the mid or late 2030's [I am guessing]) might
be able to alter the definition so the function name is just a word, rather
than a NAME, ie: the same syntax as a command-name in a simple command.
"But a man's reach should exceed his grasp, or what's a heaven for?"
Bash already allows that much wider character set, with a couple of
documented exceptions that have been around since 1988. It seems like
most shells don't, according to your previous message. It's time for them
to catch up.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
- Re: unset does not remove functions like a[b] unless -f is specified, (continued)
- Re: unset does not remove functions like a[b] unless -f is specified, Greg Wooledge, 2023/02/02
- Re: unset does not remove functions like a[b] unless -f is specified, Dale R. Worley, 2023/02/02
- Re: unset does not remove functions like a[b] unless -f is specified, Robert Elz, 2023/02/02
- Re: unset does not remove functions like a[b] unless -f is specified, Greg Wooledge, 2023/02/02
- Re: unset does not remove functions like a[b] unless -f is specified, Koichi Murase, 2023/02/03
- Re: unset does not remove functions like a[b] unless -f is specified, Chet Ramey, 2023/02/03
- Re: unset does not remove functions like a[b] unless -f is specified, Chet Ramey, 2023/02/03
- Re: unset does not remove functions like a[b] unless -f is specified, Robert Elz, 2023/02/03
- Re: unset does not remove functions like a[b] unless -f is specified,
Chet Ramey <=
- Re: unset does not remove functions like a[b] unless -f is specified, Koichi Murase, 2023/02/03
- Re: unset does not remove functions like a[b] unless -f is specified, Oğuz, 2023/02/04
- Re: unset does not remove functions like a[b] unless -f is specified, Koichi Murase, 2023/02/04
- Re: unset does not remove functions like a[b] unless -f is specified, Oğuz, 2023/02/04
- Re: unset does not remove functions like a[b] unless -f is specified, Koichi Murase, 2023/02/04
- Re: unset does not remove functions like a[b] unless -f is specified, Oğuz İsmail Uysal, 2023/02/04
- Re: unset does not remove functions like a[b] unless -f is specified, Koichi Murase, 2023/02/04
- Re: unset does not remove functions like a[b] unless -f is specified, Oğuz, 2023/02/04
- Re: unset does not remove functions like a[b] unless -f is specified, Koichi Murase, 2023/02/04
- Re: unset does not remove functions like a[b] unless -f is specified, Chet Ramey, 2023/02/04