Re: ksh: support "function name()"

2020-01-07 Thread Jeremie Courreges-Anglas
On Tue, Jan 07 2020, Klemens Nanni wrote: > On Tue, Jan 07, 2020 at 06:47:16PM +0100, Jeremie Courreges-Anglas wrote: >> Bah, I think I understand why this was chosen. bash functions declared >> with "function name" or "function name()" aren't special. Probably we >> should do the same. ...

Re: ksh: support "function name()"

2020-01-07 Thread Klemens Nanni
On Tue, Jan 07, 2020 at 06:47:16PM +0100, Jeremie Courreges-Anglas wrote: > Bah, I think I understand why this was chosen. bash functions declared > with "function name" or "function name()" aren't special. Probably we > should do the same. I'm postponing this for now, thanks for the > feedback

Re: ksh: support "function name()"

2020-01-07 Thread Jeremie Courreges-Anglas
On Sat, Dec 28 2019, Klemens Nanni wrote: > On Sat, Dec 28, 2019 at 04:07:02PM +0100, Mark Kettenis wrote: >> Are there other ksh implementations that have this "feature"? > MirBSD's ksh allows all three forms but treats `function name()' like > `name()', that is $0 stays the same and will not be

Re: ksh: support "function name()"

2019-12-28 Thread Andras Farkas
On Sat, Dec 28, 2019 at 10:08 AM Mark Kettenis wrote: > [snip] > Are there other ksh implementations that have this "feature"? As for this question, I can at least confirm that no version of ksh93 has it.

Re: ksh: support "function name()"

2019-12-28 Thread Klemens Nanni
On Sat, Dec 28, 2019 at 04:07:02PM +0100, Mark Kettenis wrote: > Are there other ksh implementations that have this "feature"? MirBSD's ksh allows all three forms but treats `function name()' like `name()', that is $0 stays the same and will not be set to the funtion's name: $ echo

Re: ksh: support "function name()"

2019-12-28 Thread Klemens Nanni
On Sat, Dec 28, 2019 at 09:53:28AM -0500, Andras Farkas wrote: > That said, I personally think to define a function with both > 'function' and '()' is a genuine syntax error. Right now it definitely is a syntax error, what that is what this diff tries to fix ;-) I think compatibility to other

Re: ksh: support "function name()"

2019-12-28 Thread Mark Kettenis
> From: Jeremie Courreges-Anglas > Date: Sat, 28 Dec 2019 14:40:27 +0100 > > We have a few ports (~12) patched because of shell script constructs > like > > function usage() > { What is the #! for those scripts? > which are rejected by our ksh. Indeed ksh only supports either > >

Re: ksh: support "function name()"

2019-12-28 Thread Klemens Nanni
On Sat, Dec 28, 2019 at 02:40:27PM +0100, Jeremie Courreges-Anglas wrote: > We have a few ports (~12) patched because of shell script constructs > like > > function usage() > { > > which are rejected by our ksh. Indeed ksh only supports either > > usage() > { > > or > > function

Re: ksh: support "function name()"

2019-12-28 Thread Andras Farkas
If this diff gets accepted, in ksh's man page, you'll probably have to change the following line as it's not entirely disambiguous how a function would behave if it had both 'function' and '()' where it was defined: "Functions defined with the function reserved word are treated differently in the