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: Peng Yu
Subject: Re: Make awk more friendly to multiline function declaration
Date: Wed, 30 Mar 2022 20:08:33 -0500

The arguments toward the end are more likely to be changed. If when
"," is not at the beginning of each line, when you delete the last
argument, you will have to delete "," preceding it. This is cumbersome
for maintaining function declaration.

On 3/30/22, Neil R. Ormos <ormos-gnulists17@ormos.org> wrote:
> 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){
>
>


-- 
Regards,
Peng



reply via email to

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