From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2684 invoked by alias); 17 Aug 2018 12:58:29 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 43308 Received: (qmail 18260 invoked by uid 1010); 17 Aug 2018 12:58:28 -0000 X-Qmail-Scanner-Diagnostics: from mail-oi0-f47.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.218.47):SA:0(-1.9/5.0):. Processed in 1.712108 secs); 17 Aug 2018 12:58:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: sgniazdowski@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=Qw81UtR2rdilhubBTWXE0LCfDtc6XwCnOoS0UbOPugY=; b=WjxS8RZAau9/1mzlMtfDgGtVrZOyiV33EfQ2orK9fdoeUOsjcQJdk+53I4I6vyd3c6 lIWPl718BvTRtaPGm8UXWmJKKb0vUx1PW/1RrxNxN29muYFBi5csVzWsjII9OTVXHt56 l1uRpDUHOl4HgL/UYk8J76qQwA67+rjzbGZF1utGejQA8KH5YpiK56EeafD1r6jhQsXG e/80iMMarG5SFdw5aKLB0F2B5zV85ZdJ/A5MBAt3WlqccEc/nm31Ln5F4oDqGM+SsATg 4UZZUgyPwzUKlbY6nNp3O4uG/rP8oi/wK/oqsmMnryPT1ob8VuoS9AXL9tG7iMDxBhEQ lBIw== X-Gm-Message-State: APzg51ADZEOq1Bk8YyAifa7nPpdxYSGnqlA3AIAzZYdaW7AMG0AhD64T 08wIbvT6jI/BlUuQrAHRCkzJZAusuQqCNsmQ0KpubEaR X-Google-Smtp-Source: AA+uWPwkDv8JbCXmeWYAxy0peoO603gNTt3I0KGITz5oFwjVTDPP42qRoPbWzCIBm9jAMAe2yVj4foowmlUYCOkyCyo= X-Received: by 2002:aca:4d87:: with SMTP id a129-v6mr2547779oib.256.1534510704262; Fri, 17 Aug 2018 05:58:24 -0700 (PDT) MIME-Version: 1.0 From: Sebastian Gniazdowski Date: Fri, 17 Aug 2018 14:58:12 +0200 Message-ID: Subject: Spare some words on coproc implementation? Builtin like coproc? To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 =E2=80=93 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? --=20 Sebastian Gniazdowski News: https://twitter.com/ZdharmaI IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin