Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103392 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 51908 invoked from network); 26 Oct 2018 19:41:15 -0000 Received: from unknown (HELO mail-ot1-f43.google.com) (209.85.210.43) by pb1.pair.com with SMTP; 26 Oct 2018 19:41:15 -0000 Received: by mail-ot1-f43.google.com with SMTP id u26so1492871otk.13 for ; Fri, 26 Oct 2018 08:56:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wtGugfzQOoVQYwjBNNPJF/MDpGKLOseu/B92cmctigg=; b=iSlfbfEdne1ZleQFVxZ8n8M916q9o+4DdUBAWvlyOzfhrthEacO/wGyTG9sFsjgH+i MB/gKCoEnU/Jp3rfq+pZa/CHnRXQqAJGtqYRVhfi+VrWbahNlMO5y0S8McX/4BoWbI8J 5ZYP9OnG24FWewAnIZh+lmZhyIrfqccKhtwrU6H9QXEA1sv8ORAxuEpIc6EFlPS++02f W+xVungUshxJLAT6lCaNisKY/QhzwRIwUXGzj2IzwRWWNYGDW5Qrcikf8UKuVdph8ucw 75JH+cLG4bo5fEh+muMdeYTyaDpbtLbySnIVXh1OyIQX5eWJBvQ35VdxbZJGc5h3CK/x zgZA== X-Gm-Message-State: AGRZ1gIOR3EFuXqncZ9fOV/SpwLxxZzMVx+D02FOun8zKdquEbD0aEI3 zdspkGptJ9Sq5jCLSJckX3OkVKz9urwPQEA6Z5I= X-Google-Smtp-Source: AJdET5ejydO0nSCVcRpwnxkl5HeP08LmP8INrIi4pjELdxsnLs9jePQvaEE9TmpsEezyB+0TE5GMh0tNlUPjpQ+GoZ4= X-Received: by 2002:a9d:7357:: with SMTP id l23mr2643998otk.204.1540569415237; Fri, 26 Oct 2018 08:56:55 -0700 (PDT) MIME-Version: 1.0 References: <2370262.6EcsR2toYx@vulcan> In-Reply-To: <2370262.6EcsR2toYx@vulcan> Date: Fri, 26 Oct 2018 17:56:44 +0200 Message-ID: To: Larry Garfield Cc: Internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Idea for better function callbacks (another syntactic sugar) From: kalle@php.net (Kalle Sommer Nielsen) Den fre. 26. okt. 2018 kl. 17.43 skrev Larry Garfield : > I believe the proposal for short lambas (which should get resurrected at some > point) would handle this case well enough as well as help a dozen other > things. To wit: > > array_filter($names, |$x| ==> trim($x)) I still fail to see why it would be considered to have that over a perfectly encapsulted string for a callback, using a lambda/closure is just an extra runtime call for syntax sugar, that seems poor in my eyes. What would be ideal here, would be for functions to be first class citizens in callback contexts, like in C to avoid the quotation, however it clashes with constants. A hack you can do in userland could be something like: const trim = 'trim'; array_filter($names, trim); -- regards, Kalle Sommer Nielsen kalle@php.net