Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103394 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 55720 invoked from network); 26 Oct 2018 19:47:50 -0000 Received: from unknown (HELO mail-wm1-f46.google.com) (209.85.128.46) by pb1.pair.com with SMTP; 26 Oct 2018 19:47:50 -0000 Received: by mail-wm1-f46.google.com with SMTP id y144-v6so1925242wmd.4 for ; Fri, 26 Oct 2018 09:03:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lAYf1cBZQMbhCzPII//l0Z6IvHht72prA4VTIssYvzA=; b=vOlTsUhY304HXH3RHqUWwIZRA4XcwIGsNhHlNoEOqHVyQeljHavShFOFy/V9KTH/V+ OEW/74rc+5kfLVesmW12V04Ig1AjqKNUPFZBSTyj7UQ2IKXw+29zkTJzhOGSekejmwbJ 65BRiWR1Px5B02QyZr/LYFNAFr1fbOLJPi0eiC4inLp0DPbH0CaMTG4B2zhu3z6HPR8D lMgm7Tzx6bBBRpTi7FzhyJPfh/cPDrll0BgkfoG1do8L9jOP4cSj9qJdneB+FkxfTYE8 g4IfmFhVoZLT7PDVeBz5LPbdwjnbbmC5BEcSFJsIcWFLlyqr3+K112YFJFN7iGBePQED DT0w== 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=lAYf1cBZQMbhCzPII//l0Z6IvHht72prA4VTIssYvzA=; b=D3mwYzI9q2jH1FJlOr9cjMcODccaGutUcmAo+pZDEH12YyWPDxxVRV16GwyNJR/4te 4f5LvW8RRKAvoTJyjWUnke2c8wmc1kuGaom5G/0nLDqTeT0zFPXsMabHgB+it7jDWWXe xYP3SqKMlyGHzUt7gy8nbmyGlkAO6Epy0VJ5GNexTf2X042lWn/EDYVhWsxo+HdmGkmP pX8iG6BVCyUbD/qxx6rwoV2B1nXr23ujgo16Y4Xsu+yNAsiaSoq6CCdu0ovQDpFV5hIX cFe0pV2S3Dk0cGQ91RROgTcrvHoi2fz4GLtIsz5uKeLQJPJ3SCfr7Sg9QDCahkDPdimt 586A== X-Gm-Message-State: AGRZ1gKjTVH2QkQLNmnztasozR5Ns4d+QmdDzWxrAjBVl38RPCvDCTs6 HCcXttFI9UNnS4Tu5YFLLlZFKOESJI1OduZLMwUYxQ== X-Google-Smtp-Source: AJdET5codJQ/O9Cvedq8deW9vUtlGw/gyZxWvPRniy8RVR4+bRP0GJP7bzL1m6f+ug7hOgQH5umNbyzAIJvbvDihbAk= X-Received: by 2002:a1c:1183:: with SMTP id 125-v6mr6122284wmr.103.1540569809678; Fri, 26 Oct 2018 09:03:29 -0700 (PDT) MIME-Version: 1.0 References: <2370262.6EcsR2toYx@vulcan> In-Reply-To: Date: Fri, 26 Oct 2018 19:03:03 +0300 Message-ID: To: Kalle Sommer Nielsen Cc: Larry Garfield , PHP internals Content-Type: multipart/alternative; boundary="00000000000041f546057923dc5d" Subject: Re: [PHP-DEV] Idea for better function callbacks (another syntactic sugar) From: arvids.godjuks@gmail.com (Arvids Godjuks) --00000000000041f546057923dc5d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =D0=BF=D1=82, 26 =D0=BE=D0=BA=D1=82. 2018 =D0=B3. =D0=B2 18:57, Kalle Somme= r Nielsen : > Den fre. 26. okt. 2018 kl. 17.43 skrev Larry Garfield < > larry@garfieldtech.com>: > > I believe the proposal for short lambas (which should get resurrected a= t > some > > point) would handle this case well enough as well as help a dozen other > > things. To wit: > > > > array_filter($names, |$x| =3D=3D> 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. > Right click on `function::trim` - Find Usages. Basically allows to find all usages of a given function, including the callback usage. > > 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 =3D 'trim'; > array_filter($names, trim); > > > > -- > regards, > > Kalle Sommer Nielsen > kalle@php.net > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Arv=C4=ABds Godjuks +371 26 851 664 arvids.godjuks@gmail.com Skype: psihius Telegram: @psihius https://t.me/psihius --00000000000041f546057923dc5d--