Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Spare some words on coproc implementation? Builtin like coproc?
- X-seq: zsh-workers 43308
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Spare some words on coproc implementation? Builtin like coproc?
- Date: Fri, 17 Aug 2018 14:58:12 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=Qw81UtR2rdilhubBTWXE0LCfDtc6XwCnOoS0UbOPugY=; b=sX680Q/umhYSG/z4gl3VPH8y+GBFwOjsFI70Yu6T2qLed4az0v7ZZ6GYbwCOrp7wv/ 8vlRGb21Qr7JRU5WCWYWNTNm34sYDgvFKi4qOoVm8G6+E+NAhjHZHXlLewjOM4gyB30f 9O82Jl1RtXB2m/4CSSN4KLMVUhwgItsej8EQ5WC8QqaFO/3qqm4aiD77kWz7XbtyIA6J Odg1hmF+HdhtLPnFLCT6oWi089t1dscxMvU5ddQfkXa5vmu0ONop+oBMPvzwm2jE9AED vpEyuyJnPK56ivxYSP2tlTWi6BTnWdjmjUszC0bvJn9SCh/GE4N0lfO7GgE9hwuFnKGB 9QoQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author