zsh-users
 help / color / mirror / code / Atom feed
* Assign to outer parameter from function called by zargs
@ 2023-03-28 16:24 Eric Nielsen
  2023-03-28 17:50 ` Roman Perepelitsa
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Nielsen @ 2023-03-28 16:24 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 762 bytes --]

Hi. I'm trying to assign to a parameter set by an outer function from a
function called by zargs.

Accessing instead of assigning works:

access_outer() {
  print ${outer}${1}
}
() {
  autoload -Uz zargs
  local outer=a
  zargs -n 1 -P 0 -- b c -- access_outer
}

results in:
ab
ac
as expected.

But assigning does not work as I was expecting:

assign_outer() {
  outer=${outer}${1}
}
() {
  autoload -Uz zargs
  local outer=a
  zargs -n 1 -P 0 -- b c -- assign_outer
  print ${outer}
}

results in:
a
and I was expecting to get:
abc
(or acb, I don't care about the order since I'm using -P 0 and I expect
paralellism could interfere with the order)

What am I missing?

--
Sent with HEY <https://hey.com/sent>

[-- Attachment #2: Type: text/html, Size: 3367 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-28 20:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28 16:24 Assign to outer parameter from function called by zargs Eric Nielsen
2023-03-28 17:50 ` Roman Perepelitsa
2023-03-28 19:53   ` Bart Schaefer
2023-03-28 20:34     ` Eric Nielsen

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).