Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125317 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 07D571A00BD for ; Tue, 27 Aug 2024 13:14:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724764561; bh=V6nLSPv0WE3biDjmiOMS3UBNfzImHsTlPXc7HeeKLH4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=E9MC0M7qIyo25lJbfNZWb/UZfEeBNlhr4120+h0KyLupA9qLmfiY11v59Qy1jPmOH QIkl2v9N9M+EVzD+fNOCzjL9Y9TArVAdJ5fXhXj17vgsFCcOwCAoDo5XLDuaQHivC0 dyJOAXpB6M5dBKnQ5KDDFf7P6qQscvbEoeSMh7UxAWlPFscGbcYhsMjuxNif6sNTPA xA5MZKjUznFKPjoD/NXTMOkqr6zyR006YfVuWGbrAmyNh4L/lPPk1MIaDbyw9hd++t BUCfbQGDCkiDXOtvs7PbVweMvkC2WTzkmCTBIIadfKKWeHGV2gJxMqD5g2q1H8Iv+H r3NyuCN3cF2qQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6604C18004A for ; Tue, 27 Aug 2024 13:16:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 27 Aug 2024 13:15:59 +0000 (UTC) Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3719753d365so2936687f8f.2 for ; Tue, 27 Aug 2024 06:14:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scriptfusion-com.20230601.gappssmtp.com; s=20230601; t=1724764445; x=1725369245; darn=lists.php.net; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=KY1fFnQgHIEJdy0sfO7Qs1q2g1aLFIUWry2+ZCWlP4A=; b=YD7cQad0AjIIN0CQVEnL4guQWcxUainAj1Ya5Bm0bRXy6DbsoZ8gZJwj0Y70SsLNgL n+P7uJVuJRA4JREbuwrWOuWcwf8CZkaaQfxnwe5Sa5KA1laLqBXoyU6Q+apphFhZ6Xcx Oe/LHjA/MjHsAmYmRZjrsNxQiCdnvxyYvztaTunyXJve+CHiG5zmGLgYkGRRlUoEI69H qX8TtZh3CoZ2yIVOWOJRxANuGWUY8W+J1Xjq6C8Ed1Vffvvxm+2nEGiR86UXTLVjRoXk hflgHYJ7LUFT5UnsAqKXZXI0bchk2QPVugjy09kdkmsO6177FVjDg8aC8cOmv8C+ikO/ /5nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724764445; x=1725369245; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=KY1fFnQgHIEJdy0sfO7Qs1q2g1aLFIUWry2+ZCWlP4A=; b=kmDguQzg109UkKDUDONZtH/eTkwLUT5j+HPnhKK4WdKBzZS4YuiX1ELLcnLa/FP3gw Z2jKiRiBg6Qw7iZelnJJC7LZ+37PH4SCaR36YSuV3LwiQKF63yM/1L80MfntBZhaESka gs5AhnGdgoqWvb5tsTFu/lCoUAeLYbObdXhSXqtvSJ0pN8dpfQck61gys2xB1e9gKSWi Kt5pWxY3wo7yjeL9rpnjcoHpeewvgLcTwSQ1XGrDh/b/i2tY0Y5wPSPMXNPIlpfpGzAJ k+Vc6p5g7mlDvqK39JznoUfB+pzV8OffEMDOTSbecJZL1H1vZf9j6w97TF+uQV0LYaR2 6DNA== X-Gm-Message-State: AOJu0YxH8XX9CdfDb9Z/5pymu/IVllpLfmrMORmMN3qBOrYNdVAgEt14 JJB8P8ssexvagiNlXbD0I5MPVvxekvaAMCJRQz9+C1Are3+o3VZvNdcGgVeDwws= X-Google-Smtp-Source: AGHT+IGsZqK/LJS4Cr+5Beu99iOItVLgw02KhumfD++poMyXBbXct8Eqq7JA9N6ziVzYP7PQxe8/bA== X-Received: by 2002:a05:6000:4388:b0:374:8fc2:a911 with SMTP id ffacd0b85a97d-3748fc2aec2mr1134288f8f.5.1724764445134; Tue, 27 Aug 2024 06:14:05 -0700 (PDT) Received: from ?IPV6:2a01:4b00:bf09:5101:281a:b503:c66b:bd3c? ([2a01:4b00:bf09:5101:281a:b503:c66b:bd3c]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-373081ffb40sm13099238f8f.76.2024.08.27.06.14.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Aug 2024 06:14:04 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------TcHp0VJFG9ZgBJc8TjVsb05P" Message-ID: Date: Tue, 27 Aug 2024 14:14:03 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Default expression To: Derick Rethans Cc: "internals@lists.php.net" References: <0c8ed5d6-5507-4c41-8d7f-05d14ba8aa4c@scriptfusion.com> Content-Language: en-GB In-Reply-To: From: bilge@scriptfusion.com (Bilge) This is a multi-part message in MIME format. --------------TcHp0VJFG9ZgBJc8TjVsb05P Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 27/08/2024 12:56, Derick Rethans wrote: > Using 'default' as a place holder for (not) passing an argument seems > useful. I am however much uncertain about using composition with the > keyword in expressions. Presumably you mean ternary and null coalesce would still be acceptable? Otherwise, it is little more than an alternative to named parameters, which is seldom useful. Ternary and null coalesce are, themselves, expressions so I expect that is why I was guided towards treating `default` the same way. Whilst the applications beyond use in conditionals still strikes me as limited, it also appears equally harmless.  Though the number of people whom feel its use in expression should be limited is steadily growing, I'm still waiting on someone to publish an exclusion list with justification for each exclusion, because again, I think a plurality of possibilities are harmless. Nevertheless, an inclusion list was produced by IMSoP, based on what he felt would be useful, but I think arbitrary exclusions are unintuitive for developers and likely to limit someone from doing something justifiably useful that we didn't conceive at the time. > I also think that implementation would probably be significantly less > complex as it was only used for placeholders. Would it? I was told that the alternative was to modify all the SEND opcodes, which is anything but less complex. The current implementation seems necessarily simple to me since it just adds a single new opcode that doesn't interfere with anything else. I say necessarily, because if it was actually complex, I probably couldn't have written the solution given my limited ability. > It's likely something that can be handled in the parser. Clearly this problem cannot be solved solely in the parser. If I assume you're proposing to just allow `default` in conditionals, what is responsible for compiling that and how will the called function know what to do with it? Cheers, Bilge --------------TcHp0VJFG9ZgBJc8TjVsb05P Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 27/08/2024 12:56, Derick Rethans wrote:
Using 'default' as a place holder for (not) passing an argument seems 
useful. I am however much uncertain about using composition with the 
keyword in expressions.
Presumably you mean ternary and null coalesce would still be acceptable? Otherwise, it is little more than an alternative to named parameters, which is seldom useful. Ternary and null coalesce are, themselves, expressions so I expect that is why I was guided towards treating `default` the same way. Whilst the applications beyond use in conditionals still strikes me as limited, it also appears equally harmless.  Though the number of people whom feel its use in expression should be limited is steadily growing, I'm still waiting on someone to publish an exclusion list with justification for each exclusion, because again, I think a plurality of possibilities are harmless. Nevertheless, an inclusion list was produced by IMSoP, based on what he felt would be useful, but I think arbitrary exclusions are unintuitive for developers and likely to limit someone from doing something justifiably useful that we didn't conceive at the time.
I also think that implementation would probably be significantly less 
complex as it was only used for placeholders.
Would it? I was told that the alternative was to modify all the SEND opcodes, which is anything but less complex. The current implementation seems necessarily simple to me since it just adds a single new opcode that doesn't interfere with anything else. I say necessarily, because if it was actually complex, I probably couldn't have written the solution given my limited ability.
 It's likely something that can be handled in the parser.

Clearly this problem cannot be solved solely in the parser. If I assume you're proposing to just allow `default` in conditionals, what is responsible for compiling that and how will the called function know what to do with it?

Cheers,
Bilge

--------------TcHp0VJFG9ZgBJc8TjVsb05P--