bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] GAWK feature suggestions


From: Andrew J. Schorr
Subject: Re: [bug-gawk] GAWK feature suggestions
Date: Wed, 28 Aug 2019 11:35:17 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

On Wed, Aug 28, 2019 at 09:25:20AM +0000, address@hidden wrote:
> -        Possibility to return an array from a function. This has probably 
> already been requested, it would avoid the need for a number of public arrays.

It would be nice, but as David pointed out, you can pass in an array, delete
it, and populate it with the results. So there's no need for public arrays.

> -        Nested functions. Not particularly important, but useful to hide 
> helper functions from public view

Doesn't the namespace feature more or less address this issue? You could choose
your own convention of starting such functions with an underscore.

> -        Block comments. Probably already suggested.

What would the syntax be? I guess C-style comments?  The parser is already
pretty hairy, so I'm not sure how easy this would be to implement. I know that
Arnold has put a lot of effort into preserving the comments in the profiler
output, and I'm not sure how challenging this would be in that respect.  It
also seems a bit weird to have such a big syntactic departure from the regular
language.

> -        And most useful for me when testing function libraries: ignore all 
> rules if a file is called via @include (or maybe a @ignore-rules directive, 
> as there may be rare cases where you want to include rules in an @include 
> file). This would allow to combine test code and functions in a single file.

This seems reminiscent of Python's 'if __name__ == "__main__"' construct.
I don't know how difficult it would be to add something comparable for gawk.

Regards,
Andy



reply via email to

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