Groups | Search | Server Info | Login | Register
Groups > comp.lang.awk > #9815
| Path | csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | porkchop@invalid.foo (Mike Sanders) |
| Newsgroups | comp.lang.awk |
| Subject | Re: {} Questions |
| Date | Wed, 21 Aug 2024 18:57:32 -0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 54 |
| Sender | Mike Sanders <busybox@sdf.org> |
| Message-ID | <va5das$3vg5l$1@dont-email.me> (permalink) |
| References | <va3ua5$3ohv3$2@dont-email.me> <87o75mpaec.fsf@bsb.me.uk> <va4k6f$3rl80$1@dont-email.me> <va4lb8$3rq72$1@dont-email.me> |
| Injection-Date | Wed, 21 Aug 2024 20:57:33 +0200 (CEST) |
| Injection-Info | dont-email.me; posting-host="c07617ccf20e561b171d3b81aed9e688"; logging-data="4178101"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19yShicTUKc4L+y5rr05IKO" |
| User-Agent | tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64)) |
| Cancel-Lock | sha1:GSp0zXnpJwKtckx/8B1Z1cefqFQ= |
| Xref | csiph.com comp.lang.awk:9815 |
Show key headers only | View raw
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
> On 21.08.2024 13:48, Mike Sanders wrote:
>>
>
> [ Concerning the basic awk syntax: condition { action } ]
>
>> And yet there's still more implied nuance somehow. Let me try to articulate
>> my thoughts...
>>
>> - These types of constructs are 'auto' ran per line of input (assuming
>> its not located within another user-written function) that I get.
>
> You cannot have these constructs with their given semantics inside a
> function. You'd have to formulate them explicitly (in the imperative
> form) with 'if', as in
>
> function f ()
> {
> if (condition) action
> }
Of course I tried & failed eariler today...
function foo() {
!boo { code }
}
>> Perhaps a potential efficiency hit to be aware of.
>>
>> - There's also the scope of variables to consider... Because any
>> variable's located outside of a user-written function or conversely
>> located within a 'bare naked' construct is global, or at least
>> exposed to the entire script's 'world', so I want be careful here...
>
> All variables have global scope, with the exception of those specified
> in a function argument list along with the real arguments, as in
>
> function f (arg1, arg2, local1, local2) { global = arg1 ; ... }
> f ("Hello", 42);
>
> (There's some caveat with arrays in the function argument list.)
>
> Janis
Not sure why that would be, can you offer more detail?
At any rate, as always thanks for the brainfood.
--
:wq
Mike Sanders
Back to comp.lang.awk | Previous | Next — Previous in thread | Next in thread | Find similar
{} Questions porkchop@invalid.foo (Mike Sanders) - 2024-08-21 05:35 +0000
Re: {} Questions Ben Bacarisse <ben@bsb.me.uk> - 2024-08-21 09:06 +0100
Re: {} Questions porkchop@invalid.foo (Mike Sanders) - 2024-08-21 11:48 +0000
Re: {} Questions Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-08-21 14:08 +0200
Re: {} Questions Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-08-21 14:10 +0200
Re: {} Questions porkchop@invalid.foo (Mike Sanders) - 2024-08-21 18:57 +0000
Re: {} Questions Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-08-22 00:51 +0200
Re: {} Questions Ben Bacarisse <ben@bsb.me.uk> - 2024-08-21 16:38 +0100
Re: {} Questions porkchop@invalid.foo (Mike Sanders) - 2024-08-21 19:01 +0000
csiph-web