zsh-workers
 help / color / mirror / code / Atom feed
* Spare some words on coproc implementation? Builtin like coproc?
@ 2018-08-17 12:58 Sebastian Gniazdowski
  0 siblings, 0 replies; only message in thread
From: Sebastian Gniazdowski @ 2018-08-17 12:58 UTC (permalink / raw)
  To: Zsh hackers list

Hello,
I wanted to use coproc's source in my own builtin because it has a
very flexible method of providing Zsh script code. But it turned out
coproc is a reserved-word, not a builtin. I suspect that issuing
coproc and then code (the very code, i.e. braces, subshells, ifs,
loops, etc.) works like if a single segment of code was provided –
coproc gets a word-code byte and just precedes its associated supplied
code which is unaffected and also compiled. This would point that
coproc is implemented in exec.c. Is this correct?

Would it be possible that a builtin (not a reserved-word), say
`mycoproc', would obtain Zsh script code normally through argv
argument in the builtin function prototype, join this argv array with
spaces to obtain single string, and then e.g. pass it to exec_simple
(plus a fork, somehow)? I think that this:

coproc for i in 1 2 3; do echo $i; done

will differ from this:

mycoproc for i in 1 2 3; do echo $i; done

because in the second case the $i will be expanded before running the
loop. So looks like no way out actually?

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-08-17 12:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-17 12:58 Spare some words on coproc implementation? Builtin like coproc? Sebastian Gniazdowski

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).