Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110421 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45116 invoked from network); 8 Jun 2020 13:22:00 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Jun 2020 13:22:00 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 884FC1804B7 for ; Mon, 8 Jun 2020 05:05:25 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 8 Jun 2020 05:05:25 -0700 (PDT) Received: by mail-lj1-f174.google.com with SMTP id a25so20133337ljp.3 for ; Mon, 08 Jun 2020 05:05:25 -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=lQ2VxaGeDJ9WE1tDUtxImnaiHHL2LSr/r04YGRUMnzo=; b=Be1ukIUMrojtnArFqzgD3SHoemGDGdwYOdOY74y2f7bNuB34KoD91UCPR/N05KtKMz TscV1hulVejao3bO9HFBXiFYnHuxygsVSJfOKkZDMZfrynbnS8BxUBDmt08kXqoIM6hV ras1ToJ9eE3Pj9Fix2FRxUWaTP+lmIN4VbMnL0WbUVxr/0l4e6XkVgraA0G1RJuvOsWd FlGIO1MpQRgOfbdUhqqQCYDfFXTAiUt4t3Qp0PI/zO3/Keff1yTDxvWA9aZsbBurnZQZ dfBrVGrxi8j+DT7kl9SVx+bgpKmvTJLxSnMAn1ISRZ9BujDBwkuZHqPm6So1T9GaQ34v XEow== 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=lQ2VxaGeDJ9WE1tDUtxImnaiHHL2LSr/r04YGRUMnzo=; b=LcnGiJtu9LcNOqiocgNvGAQYTsQSzd17C/wHVfzv06m+PiLXyrAX5EaPzSqp/SVeYa tq719Rulbyc5v+A9mWcW4jC2gzP39SC76FlHBumyXIvC4DXv54OiTvfRmFfc+LU5pH/d UG1yb8mLWifbxSlwfos3fUbmSCrsvkxrMdriVS3LNXa6T4DlYvCG9A9dipYy1Q1fUC95 1xfB56Ps43yeZC40kuQwzVTQYGUHgGCdmLDasSVeELoe/8+tYYsjrkB1VhBkBiYBKqNL MSqYS7VfNu4VFjDkd9AnbHED6160LMPYesV19JsCcqsYoT6U7hWw2oU0Q80cCP1j3sOD ud2Q== X-Gm-Message-State: AOAM530hl9k0GasSvxslRGj66XRY2wbUr+gImuQkNXs+JhpFeQPF7pxe 0VMGGbwepQ7l17WK6lXsP5E5LBsy6zC2tVqNRVopxgRdI0U= X-Google-Smtp-Source: ABdhPJz1U9b2YU7BrFmt00qxccg05GGXflEE1q1Me2E2VBku816vxWXXy5EfaXzZUZQnLZ6XLqZkVXPbUSa3mea5aLQ= X-Received: by 2002:a2e:2a84:: with SMTP id q126mr11363259ljq.42.1591617920557; Mon, 08 Jun 2020 05:05:20 -0700 (PDT) MIME-Version: 1.0 References: <49D2921E-3A55-4F3B-BF6C-6F6AF84F0CB9@cschneid.com> In-Reply-To: Date: Mon, 8 Jun 2020 14:05:03 +0200 Message-ID: To: Christian Schneider Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000c5ea8b05a7916c7c" Subject: Re: [PHP-DEV] [RFC] Named arguments From: nikita.ppv@gmail.com (Nikita Popov) --000000000000c5ea8b05a7916c7c Content-Type: text/plain; charset="UTF-8" On Fri, Jun 5, 2020 at 3:40 PM Nikita Popov wrote: > On Fri, Jun 5, 2020 at 12:45 PM Christian Schneider > wrote: > >> Am 05.05.2020 um 15:51 schrieb Nikita Popov : >> > \I've now updated the old proposal on this topic, and moved it back >> under >> > discussion: https://wiki.php.net/rfc/named_params >> >> First of all I really like this approach to Named Parameters: It seems to >> fit well with the rest of PHP. >> >> Note: I'm using the key: 'value' syntax instead of key => 'value' here >> but that's just because I prefer that syntax and think it more naturally >> extends to stuff like the shorthand syntax under "Future Scope" but that's >> not a prerequisite. >> >> I have two questions regarding to the Named Parameters which are not >> related to the LSP discussion. >> They might be restrictions of the current implementation mentioned in the >> RFC as opposed to design restrictions: >> >> 1) Could keywords be allowed as parameter names? Currently using class: >> 'foo' throws a syntax error. >> 2) Could positional parameters be allowed after named parameters for >> variadic functions? >> >> These two restrictions can be looked at separately and the only reason >> I'm bringing them up together is because the use case I'm looking at is >> HTML generation with something like a function div() being used as follows. >> Please don't discard the two questions just because you don't like this >> particular use-case, thank you ;-) >> div(class: 'error', >> div(class: 'title', "Error Title"), >> "Detailed error description...", >> ) >> >> The first issue is probably mainly a parsing issue and changing T_STRING >> to identifier seems to fix it though I'm not 100% sure if there are any >> drawbacks to this. >> > > Right. It should be possible to use keywords. It's a bit harder than just > replacing T_STRING with identifier, but I don't see any fundamental reason > why it shouldn't work. > I've implemented the necessary groundwork for this in https://github.com/php/php-src/commit/b03cafd19c01db57b89727ce77cc89a7d816077c, so now I can say for sure that using keywords as parameter name will work fine. Nikita --000000000000c5ea8b05a7916c7c--