Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ukURz-0034aT-R7 for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Aug 2025 21:16:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ukURy-00GNWu-ID for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Aug 2025 21:16:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ukURx-00GNWm-W7 for pgsql-hackers@lists.postgresql.org; Fri, 08 Aug 2025 21:16:30 +0000 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ukURv-001VSH-0J for pgsql-hackers@lists.postgresql.org; Fri, 08 Aug 2025 21:16:29 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id 301801400078; Fri, 8 Aug 2025 17:16:25 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Fri, 08 Aug 2025 17:16:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1754687785; x=1754774185; bh=oanojeYSucJcinzkjKVlofKKwP2g4yHrcQp7PK3fDQw=; b= kFBznsQlm8Z+icipK0GyP0GFumRTh6Cfx4giGIR0MJ+mzJ/99WTQfegatMPpdsVU st+mRnsX3EcfmB3TyDXarfaqUreywezdeAgdhWoCGyISVBw2eTwDfNENTsBNNY8u Du6voVgNC/HEAwSQSI6jBB1J3FYPCdnODz9p0fiHIJnKb+0VV+Q2n2L9G1vYpToV lxqBPMZhKOOi0pvvG8GbSdVJuy3OWdtPNdmf8XsyLFfm4HDknpTtAoYt6zRTzBw3 iYD2qMmVoJlA84OlOtej1ohB0ziyqs+C6rTbT9eYILYPnMfo3ZlBWJLExJjF4fnJ JTXrzAYS3Yc2vlGlZ96C4g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1754687785; x= 1754774185; bh=oanojeYSucJcinzkjKVlofKKwP2g4yHrcQp7PK3fDQw=; b=P jqVAuhXUSWpJchVMYO1t6b2b7RCxOHmGOc+b0ZsOh/Sn4l7qhvitP+MIeVUMkx9K VrHORFsafyeVj0QkP3VLlEITCM5lF1E0aJvzHNz+FsKFNFukH9RPAEHdcoRT04W/ ezHx9o37rVXl68N5O1ZeqNoHlh9OEkFr9LhFNwyGCVzQlwG/rEvzPLMvuVLc8TDI UJvVVVuwRFtxlkEOZSL2NjlZykGfebVBtKBMfrMAUiMxRHTXvCx1FNP3t9Gd8VXl gYsUjT4rj5xYu7bxvJhmQlaJRsmYJ8VAp4Uj76Jj3uEylRfQuTC7+S2X3WhLrVqZ ouP5sZvh4dhpGVQf6TL0Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduvdegkeejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufhffjgfkfgggtgfgsehtkeertddtreejnecuhfhrohhmpeffrghgfhhi nhhnucfklhhmrghrihcuofgrnhhnshonkhgvrhcuoehilhhmrghrihesihhlmhgrrhhird horhhgqeenucggtffrrghtthgvrhhnpeegkeffgeeugeefveefgeekkedtgfelvdetuedt ffdtiedufefgjeelieethffgfeenucffohhmrghinhepphgvrhhlrdhorhhgnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhlmhgrrhhisehi lhhmrghrihdrohhrghdpnhgspghrtghpthhtohephedpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepphgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgpdhrtghpthhtohep uggrnhhivghlseihvghsqhhlrdhsvgdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrh hssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehthhhomhgr shdrmhhunhhrohesghhmrghilhdrtghomhdprhgtphhtthhopehjrggtohgsrdgthhgrmh hpihhonhesvghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Feedback-ID: i1ff147bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Aug 2025 17:16:23 -0400 (EDT) From: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: Jacob Champion Cc: Thomas Munro , PostgreSQL Hackers , Daniel Gustafsson , Peter Eisentraut Subject: Re: [PATCH] OAuth: fix performance bug with stuck multiplexer events References: <87ldnvgkdq.fsf@wibble.ilmari.org> <87fre1h90x.fsf@wibble.ilmari.org> Date: Fri, 08 Aug 2025 22:16:22 +0100 In-Reply-To: (Jacob Champion's message of "Fri, 8 Aug 2025 13:52:09 -0700") Message-ID: <87cy95h5uh.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jacob Champion writes: > On Fri, Aug 8, 2025 at 1:07 PM Dagfinn Ilmari Mannsåker > wrote: >> $ perl -MJSON::PP=encode_json -E 'say encode_json([1, 2, 3])' >> [1,2,3] >> >> $ perl -MJSON::PP=encode_json -E 'say encode_json([1 => (2, 3)])' >> [1,2,3] > > I swear, this language. > > But: > > $ perl -MJSON::PP=encode_json -E 'say encode_json(1,2)' > Too many arguments for JSON::PP::encode_json at -e line 1, near "2) > $ perl -MJSON::PP=encode_json -E 'say encode_json((1,2))' > 2 > > So what's going on there? (Google is not very helpful for these sorts > of Perl problems; I don't even know how to describe this.) That's because encode_json has a prototype[1], which changes how the argument list is parsed: no longer just as a flat list of values like a normal function. Specifically, it has a prototype of '$', which means it only takes one argument, which is evaluated in scalar context. So the first example is a syntax error, but in the second example the parenthesised expression is the single argument. Becuse it's in scalar context, the comma is actually the scalar comma operator, not the list element separator, so the return value is the right-hand side of the comma (just like in C), not the length of the would-be list. Onfusingly, they are both 2 here (which is why 1,2,3,... are bad values to use when exploring presedence/context issues in Perl, sorry for doing that in my example). More clearly (fsvo): $ perl -MJSON::PP=encode_json -E 'say encode_json((11,12))' 12 - ilmari [1] https://perldoc.perl.org/perlsub#Prototypes