help-gawk
[Top][All Lists]
Advanced

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

Re: Make awk more friendly to multiline function declaration


From: Neil R. Ormos
Subject: Re: Make awk more friendly to multiline function declaration
Date: Wed, 30 Mar 2022 18:37:07 -0500 (CDT)

Peng Yu wrote:
> Neil R. Ormos wrote:
>> Nelson H. F. Beebe wrote:

>>> Peng Yu <pengyu.ut@gmail.com> has asked about
>>> changing gawk's grammar to permit newlines
>>> between parameter names and commas.

>> Missing from this discussion has been serious
>> consideration of whether Gawk users might
>> benefit from the proposed relaxation of the
>> grammer.

>> The original poster did not describe any
>> benefits other than relief from what the poster
>> views as an artificial restriction.

>> It might be helfpul to understand how the
>> original poster believes the proposal would
>> have some material effect in making it easier
>> to write Gawk programs or making the language
>> easier to learn and remember.  Does the
>> existing rule impose some unreasonable burden
>> on a particular class of users that relaxing
>> the grammar would alleviate?

> The requirement of an extra backslash is
> unnecessary. Removing that requirement can leave
> users with the freedom to format the code in
> multiple lines. This is especially true when awk
> lacks the concept of local variables. In that
> case, putting "local" variables in separate
> lines will make the code more readable. This
> should be a rather common thing to experience
> when you start writing awk functions.

> Awk syntax should make it easier for users by
> not requiring an extra backslash to be added
> when the comma is at the beginning of the line.

What reason is there to have the comma at the beginning of the line, instead of 
on the same line as the parameter it follows?

Is the first of these any easier to type or understand than the second?

function franz(anna, gregor
  , frieda, georg){

function franz(anna, gregor,
  frieda, georg){



reply via email to

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