Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99458 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76155 invoked from network); 8 Jun 2017 16:28:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jun 2017 16:28:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 74.125.83.43 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 74.125.83.43 mail-pg0-f43.google.com Received: from [74.125.83.43] ([74.125.83.43:33508] helo=mail-pg0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EF/04-27119-C3B79395 for ; Thu, 08 Jun 2017 12:28:45 -0400 Received: by mail-pg0-f43.google.com with SMTP id f185so17689097pgc.0 for ; Thu, 08 Jun 2017 09:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=QgeGdPv9hFDAwe7onhZ+WTtaJyURT/HlvZvWSc6D6aU=; b=Wy3Hq5qya9Xg4e7SYFQJvZl2uXBrELzq+OR6FkUtkp9taE/dSgEL7T3Ol7QDXKc3PM vYlXGmdGzmMDcAda3oxP6WBmEMyz1Bo6eMuKHIZoKUOOXPqoQWMICRY7tRoba/ZhiMXF I1HqKoh1hCgKM1vcP4QOAmyFH7SH5azNy5PtyuIzgBGv+J2MJi00TGtDyzd0HoXMpMJv RtB3mjHACTjoTkt4dY4AVEivYEFDYdTJeDVK3+FHTl8ho84BL6Yn0ZNOPshI2XnxxSs6 U1JL0sxvLUHW8/IQWcEvn0/we2Ar2l0DxRugUvDD6PE9JEYUw2KCYCX0yBr1jzct99oh 31gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=QgeGdPv9hFDAwe7onhZ+WTtaJyURT/HlvZvWSc6D6aU=; b=cq/DRp5mYAo98d+1ZQIClac0SdlFbgviEf/+NZ+XfYWgMpmi1xL0bDi+MsvkNaiyQX vRL8Kn6SBma/JWPJHNEC/RL09/c59kbl6XkoHRTviQCplPxYnCJW0xtPPdZJlgE6LrNm xBR7jm9iGBVRD+Fg5FK85zN0o+KXLKp/Xd2htHa82vdR8YAHFWvgaosok3tzEUqFaRfZ +3Cle+LfP1YeA0GTdu0+KsFKqQOIISC/0aoQvLzuguvTeUU9A5OKSVQNtSefXwy7h6zM mcFTA+gbR6p65m/mSDKVP+HvkGlvEKwwDZZ+rQvHZ3qZsIk0r/BKa9dP0mD972GsMhea Vwmw== X-Gm-Message-State: AODbwcCc6D8BmyJhHp9mStHXP4sB5drqYMFH1go0tYA83wI02t/6Wn7p RdDHIn+AyP0gVVV+0CGy8SBcZS1ENTvbSqPOng== X-Received: by 10.98.103.134 with SMTP id t6mr6635207pfj.83.1496939321414; Thu, 08 Jun 2017 09:28:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.131.23 with HTTP; Thu, 8 Jun 2017 09:28:40 -0700 (PDT) In-Reply-To: <40dc6de9-7e05-e043-e8e3-9e93409be2bd@fleshgrinder.com> References: <7eaef49b-bf60-9aa1-e812-8430164e3178@garfieldtech.com> <3F920987-38CB-42DD-888D-824430C36F14@gmail.com> <2f9e73c9-444a-11d0-459a-e261ea8a7080@telia.com> <4077c099-2247-c3c1-7dee-02a6b25f8586@fleshgrinder.com> <559b73f7-c40f-e593-f0e1-51b56210d7cb@telia.com> <2053A608-6B66-42FB-A6D7-7CC64E94DA6A@koalephant.com> <4FBDE643-1EBC-485A-A39F-7E28C5D4807A@koalephant.com> <40dc6de9-7e05-e043-e8e3-9e93409be2bd@fleshgrinder.com> Date: Thu, 8 Jun 2017 18:28:40 +0200 Message-ID: To: Fleshgrinder Cc: php-internals Content-Type: multipart/alternative; boundary="001a1137111a811f0905517558b5" Subject: Re: [PHP-DEV] [RFC]Discuss] Syntax for Arrow Functions From: rasmus@mindplay.dk (Rasmus Schultz) --001a1137111a811f0905517558b5 Content-Type: text/plain; charset="UTF-8" > it could be a single symbol instead of two even if this can be done without parser ambiguity, it suffers from visual ambiguity with the assignment operator. consider what this would look like if the expression itself uses the assignment operator... f($x) = $y = $y + $x; versus something like: f($x) => $y = $y + $x; even that is visually ambiguous when used in arrays though: $a = [ "foo" => f($x) => $y = $y + $x, ]; also unreadable. even if the parser can cope, I think we need some other symbol that isn't visually ambiguous when used in these contexts? On Thu, Jun 8, 2017 at 5:56 PM, Fleshgrinder wrote: > On 6/7/2017 9:45 PM, Rasmus Schultz wrote: > >> the `fn($a, $b) => $a + $b ** $c` syntax suddenly becomes an acceptable > > compromise. > > > > I have to second that. > > > > I might even propose to shorten it from "fn" to just "f" - the resulting > > syntax then resembles a mathematical predicate :-) > > > > I really like your thinking here. +1 for just `f`. > > I am not sure why we would require the fat arrow anymore. We most > probably want some symbol there to separate the return type constraint > from the body, but it could be a single symbol instead of two: > > f($x) = $x^3 > f(int $x): int = $x^3 > > We could go full math here! :) > > -- > Richard "Fleshgrinder" Fussenegger > > --001a1137111a811f0905517558b5--