Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103398 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 99669 invoked from network); 26 Oct 2018 23:42:57 -0000 Received: from unknown (HELO mail-vk1-f169.google.com) (209.85.221.169) by pb1.pair.com with SMTP; 26 Oct 2018 23:42:57 -0000 Received: by mail-vk1-f169.google.com with SMTP id o10-v6so591804vki.6 for ; Fri, 26 Oct 2018 12:58:39 -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=4RPJFXo/O0ygCVP9if/L23hmbPB4zicbM1RiGwRTLpw=; b=Fh52HE8qzJNmyoBpqB3Mo1fgKDntifHN1mDlw/mto2Jzy22fGJVapSnc9k3hwI7ZCI GvhzPQXu9I+rjFEOaD2YQnxpzvJYY8iQ5kmOIaLIahcxoDNweQRjqYd8Zg1qRH4IY/0i OEfXaOFe+ZwFHoE8jQCdLGB7VBKTPxy8RQr1n1h+v9gXcUppTxchANrQMvQWqAeqy35O 4OBF0+DhiCjhTzUO0OyMxg+v9fhw9bkMDkq7mF7Ycju0YWxl2O2kdrfx6L4Ndyq4h+Zo p0p4YQO0RhSNP+u32lHGlhruIqoat4XKnQATstM6MkQl3h54Q4XTd8aAN7F/73YRKl57 6Xow== 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=4RPJFXo/O0ygCVP9if/L23hmbPB4zicbM1RiGwRTLpw=; b=lfju05zMTH8IefYSN1jBa0s1x6c+psLHvJkYpWrS6FpWUpZ9gLbG+JUL2HheLlMbgV vVUuR8B0dXuUEOIiWNBdYCKcx4Cr8tMYGJGKkgDYk7G6I3zWTFFuShFX9V15IYwg+ntV vkOTXgeTKiQmFkatNrabl/aMf5NuEJGKPY5R/7a777nG/bxiV+XUg/8Uj3YXJLdq4rbV YVzOHx9YtC1YsQl7HCiv6hT7JM+uI07J3vgmzhnBgGsY4ML843P7LpEN2Dwron4kZRO7 frefo2drLcaW4IBzBDgg8ffyoZFnzXMAmcHjKO7f/5aGL/fCOtd/sxtsiON6WQOny8b8 irRA== X-Gm-Message-State: AGRZ1gJzmpyS8WH0s6d3Dx9ejrn9oIgEqNNjbabcKBiyPpfGN5Jq0XsH mtc6LjyKi4yOISzd/rk+XRqmqAmpySAUROrOUu0= X-Google-Smtp-Source: AJdET5eDPIq9dglS9o7YC3evYBXnXWiKa9OwqUouuGT38l+BJoNx0H/1ZSX/fVJG6cHfM7dBKqVCfQaEkfDX5xavy+o= X-Received: by 2002:a1f:8011:: with SMTP id b17mr2197134vkd.31.1540583919238; Fri, 26 Oct 2018 12:58:39 -0700 (PDT) MIME-Version: 1.0 References: <2370262.6EcsR2toYx@vulcan> In-Reply-To: Date: Fri, 26 Oct 2018 21:58:26 +0200 Message-ID: To: Levi Morrison Cc: Kalle Sommer Nielsen , Larry Garfield , internals Content-Type: multipart/alternative; boundary="00000000000040c5f3057927258d" Subject: Re: [PHP-DEV] Idea for better function callbacks (another syntactic sugar) From: crocodile2u@gmail.com (Crocodile) --00000000000040c5f3057927258d Content-Type: text/plain; charset="UTF-8" That sounds like a plan, and if there is a reasonable support for that, then we could just have array_filter($arr, trim) - then its way better than my proposal, and should also work with class methods. On Fri, Oct 26, 2018 at 6:03 PM Levi Morrison wrote: > On Fri, Oct 26, 2018 at 9:57 AM Kalle Sommer Nielsen > wrote: > > > > 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 > 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); > > In my opinion "ideal" here is that our symbol tables are merged, so > referring to "trim" in any context will resolve to at most one symbol, > *and* that we also have a short-closure syntax for times when there > isn't a *perfect* function to use. > > In the next version of PHP I would really like to see some warnings > for when symbol names get re-used so that in the future we can merge > them with less of a BC break. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Best regards, Victor Bolshov --00000000000040c5f3057927258d--