Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127423 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 lists.php.net (Postfix) with ESMTPS id 954A01A00BC for ; Thu, 22 May 2025 09:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747905773; bh=+o1GjDCsBTTmHNgCuBtas2Hd9CZICrwrVpeG5TbyaDA=; h=From:Date:Subject:To:From; b=SM6M65GFDfdSytqKHfzRmNLn7XaO2mRkUZfeuHzzFH17QrE7dGWUbguNCO+vviFfV A/GLghdYudlP5wDxjUma553UtZrTU4kRGQy/U2GDSIQI4YdpFu+CYdzbNu8UifTgeq FwmstmY3HI4Ozfrr94YuuIJu83tW3KS1A3sWVsENnrMj+twLgi1ktQPtMTRoOGFbO3 sBm91xLlD7NtxzJ2EK0KrUvDZUk93gm6aYnzn2yKylcoTgr6NqbU3fe8TDiF6whvY0 1ANqyB2yuehjBcvidnNy4O8WXawlkFtDdM9A1VGRgl+53hZj/1LoMLjgqksAWP1It7 Hszk23AjOpzMQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 004F6180061 for ; Thu, 22 May 2025 09:22:53 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 ; Thu, 22 May 2025 09:22:52 +0000 (UTC) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-23228b9d684so48703755ad.1 for ; Thu, 22 May 2025 02:25:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747905900; x=1748510700; darn=lists.php.net; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=+o1GjDCsBTTmHNgCuBtas2Hd9CZICrwrVpeG5TbyaDA=; b=gIGoeqgAAVMHVMyXWVvpzcWqKxYxEyTGQUSqVInzFba9tiGt1hbRAUzD/8groRzhVx v7C7kOrW4meFsaXxRXlE234BIeGqaj5jN/uYt+z50T/qQTk95sqlEPQzCTqVZCZJ7riS A40pSWDfsCVdsQo49z/zoqfkDmyj6MRSS80aC6Gj04Y0Bk4rFjJBHwFFH2UMDv+yTy3m WH9Psr100Wzy4CIN1cbwQw98cTysL/xQEy4QQ0Io9WmLCRe0On9jdkjGo3HqPq4nQNJW Or/+X32hV19OzoaUFiQ9CsWVVs2hFUz3FLtqkPF+aAm8Ah9oj44ZFFWESROd7ElpAlU7 mrDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747905900; x=1748510700; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+o1GjDCsBTTmHNgCuBtas2Hd9CZICrwrVpeG5TbyaDA=; b=JZUxtb6qXPktjmmg6rGlKl+ylRIahwU44mf/uT3rVuMZEWnnI+CNyFPNPzWb4yUhg0 iCaCtULcogiSbz33abc/bw5AQtmtKUYTIfWvEwAvo6r8yslME9UKdDXiGBedB3ZsbKfl i2sesMrKTsGKkd8pAPGEqK0z+6Tc+PPZt1XLy618+A58tbFiKefEPvAXrHa95L0eXd5p hfGNJj3VGYTwLpDDhiIp0tVdfGNxTYPDInilew3SV+aF17ZBei4/cAKyHttaCrslgS9M aLnPR2RhEjVasDstJOwm7Mzewm1tjJ/IYK8gEuxwMzrLUCdV8OLYeKjfmvP3KNAWWEDd 9drQ== X-Gm-Message-State: AOJu0YzC2UHpwFF6vmq/UU+fTj9UfVtsWVVGO5JajMofcePWMFJtqFZE y5i/QRi224CR120DwjXf5ZDV1zj+6VDMv1sOLHb4iPjKu1NrmpNT6JL1uER9mST9WzWAUisOixg 8M0wbOr3yPcKU1pwNIV1qk+PH3WI2urO3ubnaW4g= X-Gm-Gg: ASbGncvxHSJaLhE9XDMYhjlXs7SdEbZ5l4afzR4WaMNCQQvd/hk/G/KV7VRzHXmiwJI Jo0rM/uFz3DQw9rq/TfUijY56xz3TNcZsUEAGRUSqNmhT9JLHpStqluTZs4UNqF4veU20EP5vYB U56zlNkTd62DgeCS/v/a//0ArHJX4c/FU7wA== X-Google-Smtp-Source: AGHT+IHwxKuEaVyx0IxTAvDYXrnIu3UuReQDxu9HuJIKBXvlWxEbZIkTNWwj2rtdIs2n4NE0qAv+ZTSF1rYTOt6wh0k= X-Received: by 2002:a17:902:d543:b0:231:b7e1:c977 with SMTP id d9443c01a7336-231de3763abmr346028425ad.29.1747905899919; Thu, 22 May 2025 02:24:59 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Thu, 22 May 2025 12:24:48 +0300 X-Gm-Features: AX0GCFufxuJLNlwTj-VKNCQNjpDBFxO0Z92KQQaOi2TTcC_a41LxiBgsSNaA-OM Message-ID: Subject: [PHP-DEV] RFC: Single-Expression functions To: PHP internals Content-Type: multipart/alternative; boundary="00000000000043ff220635b60e8d" From: xepozzd@gmail.com (Dmitry Derepko) --00000000000043ff220635b60e8d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, Internals! I hope this message finds you well. I would like to respectfully propose single-expression functions for PHP: https://wiki.php.net/rfc/single-expression-functions I've had extensive experience working with Kotlin, which offers a modern approach to Java development and enables cleaner, more intuitive code. Through this experience, I've encountered various concise syntax features, and I believe one of them=E2=80=94single-expression functions=E2=80=94could= be a valuable addition to PHP. I'm aware that Larry Garfield previously proposed a similar feature several years ago, though it unfortunately didn't pass the voting stage. I would like to respectfully suggest that using "=3D" instead of "=3D>" to separate declaration and implementation might be a better approach. I believe this proposal aligns well with PHP's current modernization efforts and the ongoing initiative to simplify various language constructs. PHP has been consistently improving developer experience through features like property promotion, arrow functions, the nullsafe operator, getters/setters, and other syntax enhancements. This single-expression function syntax would be a natural continuation of this trend, further streamlining the developer workflow and making PHP more pleasant to write. The primary motivation is to help streamline "data classes" by eliminating the need for "{", "return", and "}", which can sometimes account for up to 30% of the code in such classes. This improvement would be particularly timely as it directly enhances developer experience=E2=80=94a key focus of = PHP's recent evolution. I would greatly appreciate your thoughts and feedback on this proposal, and I'm looking forward to engaging in constructive discussion with the community. Thank you for your time and consideration. --- Dmitriy Derepko --00000000000043ff220635b60e8d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi, Internals!

I hope this message finds you well. = I would like to respectfully propose single-expression functions for PHP: <= a href=3D"https://wiki.php.net/rfc/single-expression-functions">https://wik= i.php.net/rfc/single-expression-functions

I've had extensive= experience working with Kotlin, which offers a modern approach to Java dev= elopment and enables cleaner, more intuitive code. Through this experience,= I've encountered various concise syntax features, and I believe one of= them=E2=80=94single-expression functions=E2=80=94could be a valuable addit= ion to PHP.

I'm aware that Larry Garfield previously proposed a = similar feature several years ago, though it unfortunately didn't pass = the voting stage. I would like to respectfully suggest that using "=3D= " instead of "=3D>" to separate declaration and implement= ation might be a better approach.

I believe this proposal aligns wel= l with PHP's current modernization efforts and the ongoing initiative t= o simplify various language constructs. PHP has been consistently improving= developer experience through features like property promotion, arrow funct= ions, the nullsafe operator, getters/setters, and other syntax enhancements= . This single-expression function syntax would be a natural continuation of= this trend, further streamlining the developer workflow and making PHP mor= e pleasant to write.

The primary motivation is to help streamline &q= uot;data classes" by eliminating the need for "{", "ret= urn", and "}", which can sometimes account for up to 30% of = the code in such classes. This improvement would be particularly timely as = it directly enhances developer experience=E2=80=94a key focus of PHP's = recent evolution.

I would greatly appreciate your thoughts and feedb= ack on this proposal, and I'm looking forward to engaging in constructi= ve discussion with the community.

Thank you for your time and consid= eration.

---
Dmitriy Derepko
--00000000000043ff220635b60e8d--