From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30729 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bastien DUMONT Newsgroups: gmane.text.pandoc Subject: Re: Walk and deep copy in Lua filters Date: Sun, 12 Jun 2022 20:41:42 +0000 Message-ID: References: <87tu8pyaur.fsf@zeitkraut.de> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8357"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRBCM7TGKQMGQEGBUAVSA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Jun 12 22:41:50 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lf1-f59.google.com ([209.85.167.59]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o0UP8-0001yO-2e for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 12 Jun 2022 22:41:50 +0200 Original-Received: by mail-lf1-f59.google.com with SMTP id u7-20020a05651206c700b00479723664a9sf2171622lff.6 for ; Sun, 12 Jun 2022 13:41:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1655066509; cv=pass; d=google.com; s=arc-20160816; b=1JbWKuVVXkYr1m3ZmD+a3VUO9NHRmBlU2q5VKYMn18JgMmCKFBeT45aDnwFBdSfhZa cW567OTT5sFOP8GoYjxnSrjkWXv4+nOw9uBfol+O3VK2DFO2dhyASri04KvEW9UhsqPv /9wttIkCkBsAXCKEhrCIroHUg+0bQvIxfFRwvwLvufz4oFkV8uJ012CqbR0n/mgfTDdj us3C0bP/Aj7mlkbuyl5bIkRf86Iwr1tK4Kj6Z1Q+JU/PLZT2CMmJTbvpNq3IA3Zc+j4C VqAViqdtodDTZ7yq18FBFLChRyrfZ5R5e+6avmSMuZ5odfwD293jW2TsbgvxvmhzgRbv cGrg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:dkim-signature; bh=6KjjvVLC+vlaC23RYeFr6as0wfqbo9DnnjJcUvXZaPI=; b=lwU566s9Oa3Je90Gpzbug5pOcSugElsrJpFYMqBv+RvODOPFQ4p4SGMAn4GSdPiEY2 VJ/aX55o+9axucTXZ2Lo2/RvA/CI7OuNWTHw4xV6sQYeqgGgLcAHBObTIC1sc6NSN+QW 7nuM5DGP/AWgDVkaW2YSPoHCjesAsALI7UHTbxclTvz07vx9YatJgHUgA7avyEIGcar9 QAvpaGsy2avqHJcpwu2I3E+noYl5s+QgVVEtSJaOxYOOHXKpTQir8nOUeY1RJ6D+l0iP fPxBEzVI/A86IAR7zr/L07wmO0tz3MRV9/2AqX7+KHXyrmBhWogD/ZHQ/DKoQ30B0bxP 1jIg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=Zt4EF3D+; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=6KjjvVLC+vlaC23RYeFr6as0wfqbo9DnnjJcUvXZaPI=; b=df9gUBsZeAjDUgyJ7surETOxLSD1gXAxo8NnNoR34toabB+YsDFgYloxFIjhOgfwJI DnBZ5jFydgrBoIHprcIU8VrJIf9rOMalZmFWZ57r+4fORvqDmeno2bOeNilHRlj5kjKx ZQKsHtKjKpMfDHVEo+oIOZifXD0iwOogBwV66MBu3kyEbbMkQ5+UPPKTQ4D7+wT37mUB Q5ahX4LZRyUnLybd6596s4CRTQ2vxZo4Gqf1uYI4crf/JEm8Uiw18CCZUC+okrNUyvJn mPvzGptAG+gjMKeQA0eZaeCUmkXrrIkIpN9DS+e0/RpZA5MbRJ21d5lRcjVOrDbrQ65V UVvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:date:from:to:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=6KjjvVLC+vlaC23RYeFr6as0wfqbo9DnnjJcUvXZaPI=; b=UGxjQIOA3cp9BqXbeW9PxVj7kOCB9h9zUJk5Lb84E9mI+U8modqfnKRpJmiREpfeUI felVW/ohxcbCYurDnLTWpql5NbuIgzBHWYywoIj68jUCXKwFmjsbY6yUYovQJ7KVcdtX mrCPY79VxQHxaqE5DbaQh7fZrd/2nSbsBkYeyuR8azAqZGDC+DTqI8LjDB5BnzOYmxqO aRfO39f0H6jw6gQGkv89qXHcPCiDt++vnkcexGqZuUW6LPvpZR+9PUW4FvradxMyOQTE 6Ih7tI5l66WJ2f42aEdgJmnGkAD1kTXuS8fWatIspdk5 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM530Ev+snWieBQf+8Gf+p7+tjZhdmxuMKX+iQBLE3aVjrjsZE2HU2 Q6NjhN2SmK4dYnQNUW7Q0po= X-Google-Smtp-Source: ABdhPJxXpsDBz5DnHZzMgIDvh+WCTjnQv3boUZHaeaLMlPsyU8La4AE9wTECT1kKrFugcvbX6z5v8Q== X-Received: by 2002:a2e:b6c5:0:b0:255:7c46:f399 with SMTP id m5-20020a2eb6c5000000b002557c46f399mr25617255ljo.205.1655066509286; Sun, 12 Jun 2022 13:41:49 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6512:b1c:b0:472:38f0:bc75 with SMTP id w28-20020a0565120b1c00b0047238f0bc75ls979752lfu.0.gmail; Sun, 12 Jun 2022 13:41:44 -0700 (PDT) X-Received: by 2002:a05:6512:234e:b0:479:3bb1:8d3c with SMTP id p14-20020a056512234e00b004793bb18d3cmr24354458lfu.478.1655066504565; Sun, 12 Jun 2022 13:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655066504; cv=none; d=google.com; s=arc-20160816; b=H3Z8vxFGLopm7ibrtFUm8enOIS1qXIuCrMnwjlaHGC7kiTJBxUAIRmgDCxO94aM2Vf 77XEKM63Tje41c6JoMlIgRc2KRWe+F45q/hFxvGRUbaeC1ztitO1UZmybFfBEfRsSXrV UjUcRLGkU0xH3+/EWIdDq8NQFmTv/VHrbl+m+vzUai3NjB48tXqKtripSqoTcS15LhM5 bTbTB6QbWWwR+d4n1/Fjj4GXwDLf5oITA2TBSPZza27IAQ5II4u6ehD37b1gkQhDDFN7 Bh7sYi+lOf2tXT4EOF5Qp3+td+26fppG1Ibhx9D3+nfqUdk7ZnMxFp6Zmc89FF/tZlLl rL2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature; bh=d9qDMY24VTzcOm8zZKXSrrCbMDSb1nHZXXRsSYm3KtM=; b=DC+2//o1feT5WHYdEcGXprHOUzV5h1tgI/vuh2m6cr+u82A7XvL2utxv/kG9gCjb47 aCGcxg8GzialtIcrp/Qa99dEcWXOYJz410loRdaWkhe8r0IrGe5AT9dcDw5KDdn502hq uUlCcfQYN/8fp6A3ISgRnO3HF/mzSVmZj3aHD73tb1LCixJsrvnJ3l9jRlFVeRCN6bwM ftSGkxdzcQM2g1ygKk/VRISNc7VarWwWCrIQpgia5uu7rj/TOVQrTTfD2orci/v5W6s6 a3+XgYOpgRQgS1l/PfO79jVWiLGN+TtOLTkOVK3Xc81K9z9i0fNm1isj3tdlFAiJ6FTC +pcw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=Zt4EF3D+; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Original-Received: from mout01.posteo.de (mout01.posteo.de. [185.67.36.65]) by gmr-mx.google.com with ESMTPS id w25-20020a05651c119900b0025594e68748si148631ljo.4.2022.06.12.13.41.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jun 2022 13:41:44 -0700 (PDT) Received-SPF: pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) client-ip=185.67.36.65; Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id EACA0240028 for ; Sun, 12 Jun 2022 22:41:43 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LLmnz410Zz6tmM for ; Sun, 12 Jun 2022 22:41:43 +0200 (CEST) Content-Disposition: inline In-Reply-To: <87tu8pyaur.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> X-Original-Sender: bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=Zt4EF3D+; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:30729 Archived-At: OK, thanks! I will submit a pull request tomorrow. For BPJ: `clone()` returns a deep copy when called on objects, so it could = be used in the example I provided. However, they return a shallow copy when= called on Lists, which is my real use case. As you can see, the following = chunk throws an error: ``` local orig =3D pandoc.Emph({ pandoc.Str('one'), pandoc.Space(), pandoc.Str(= 'two') }).content local copy =3D orig:clone() copy[1].text =3D 'first' assert(orig[1].text =3D=3D 'one') ``` (In Lua, almost all methods in `table` modify their first argument and retu= rn a pointer to it.) Le Sunday 12 June 2022 =C3=A0 08:41:06PM, Albert Krewinkel a =C3=A9crit : >=20 > Bastien DUMONT writes: >=20 > > I just discovered by chance that the method walk returns a deep copy > > of the passed object, leaving the original object untouched. [...] > > > > [...] Nevertheless, since it is not really documented, can it be > > considered to be deliberate and stable? If this is the case, could it > > be possible to make explicit in the documentation, under the header > > =E2=80=9CResult=E2=80=9D, that the original block or inline element is = left unchanged? >=20 > Yes, this is deliberate and won't change. A PR to improve the docs would > be very welcome. >=20 >=20 > --=20 > Albert Krewinkel > GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 >=20 > --=20 > You received this message because you are subscribed to the Google Groups= "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an= email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgi= d/pandoc-discuss/87tu8pyaur.fsf%40zeitkraut.de. --=20 You received this message because you are subscribed to the Google Groups "= pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/YqZPhvGeWIZaIPct%40localhost.