bug-gawk
[Top][All Lists]
Advanced

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

Lint options


From: James Ghofulpo
Subject: Lint options
Date: Thu, 29 Apr 2021 07:51:36 -0400

Would it be possible to add options to gawk lint?  There are many things
that I do intentionally that lint catches which are not errors:

- Shadow variables (I have huge gawk scripts, and to prevent possible
nesting issues, I use shadow variables).  In fact, it is often more useful
to know which variables are global than local to avoid possible conflicts.
I'd rather have a feature to explicitly define a shadow (nested) variable
rather than the hack of adding on parameters in the function header.  I
usually end up writing code like:

function xxx ( param1, param2, \
                      shadow1, shadow2 )
{
...

The backslash is ugly (not sure why the parser needs it) but when I have
lots of shadow variables, they don't all fit on one line.  Could do a weird
construction like:

function xxx( param1, param2 )
    ( shadow1, shadow2 )
{
}

or

function xxx( param1, param2 )
{
    var shadow1;
    var shadow2;

I'd prefer the last method; even though it's adding a new keyword, it's
explicitly saying what's going on.

- Function defined but never called directly.  I have libraries of gawk
functions, many of which aren't called from scripts.  Maybe lint should
ignore these errors if the functions are being included in a library?

- Warnings about gawk extension.  Maybe something like:

@requires 5.0.1

That way, it'll fail nicely.

I know there's the push to have gawk be compatible with the one true AWK,
but it always saddens me to think that awk is a dead language that is held
down by its limitations.  I'm a huge fan of the processing power of the
language and the quickness that something can be written.

Should I look into cloning the repository and adding the features myself?

If this is going to Arnold Robbins, please know that I am a fan of what
you've done to the gawk community!

James


reply via email to

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