Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121557 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 56296 invoked from network); 2 Nov 2023 20:03:42 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Nov 2023 20:03:42 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D46B31804D0 for ; Thu, 2 Nov 2023 13:03:41 -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, T_SCC_BODY_TEXT_LINE 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-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 2 Nov 2023 13:03:38 -0700 (PDT) Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-5a90d6ab962so16338787b3.2 for ; Thu, 02 Nov 2023 13:03:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698955417; x=1699560217; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vzg1twjJcxqy/11D2eJopGIpxzIuMJUeKhelf5+VDM8=; b=HOXgyy5OghAvPc0gM2QN0pHOmJmKpn41shpHzv1/+5iomKGoyKB+7qoS4TuU3tLy9A kfaGEzL/pYKgfOm2q+OTzBxf9mPxpsZBY30wv6JS6l8U88+YGj5ZMIZjzD3chjbLP6II 9EQ4stmISgXEU9wjJB+I/WdrTtxZ6QdRMN2Q8PLsgnSN5ttPN9EAOH5os24oCe+b1bao NR+Fx6qNseNP9e1hrBcJxQr+uDyEFjVZOah09rcpfhH+oGmZyRI6jdm3I4ItZLVCPr7e d7zOGQdhsWayl6tLwxG35hXKc0dUE2qKGcy6Lg/At0xkVYnp984HlSKWHG3y6pkb4Wu8 B77g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698955417; x=1699560217; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vzg1twjJcxqy/11D2eJopGIpxzIuMJUeKhelf5+VDM8=; b=Ig3nnoNzERp1Xp6hcar4A8QA8bGsaJVdU2mxoUIx+wTJP8md7oyuZzkKh/xJpFxtR7 6G+GEu8J+QsfnyEWXjOYA6ZwVYnP2tFpghs7soth642Xq0EOEa52IIvThmOtVZ43otJF o+IAmxwzQIoCWvaxobJ2nGao8jdrhrheBUcC+DkrYUqyxwE1F9tES2ZvkGS4BT0w35MM lDZDB5ITzvkCDlc/g4lRk11jCNSpTvKndw8nFJ7gnRTCx5bEuZWDXJHxtS6Ke6gPWKrY W3Z1JUwGLLr5ytHALhTJhfwsuqDzNc+VdzjDpz05o2TWkRgLJ3jogiNK7nKpufrCVM65 VycQ== X-Gm-Message-State: AOJu0YxNGVPP3FRU0wUbax3E9O3PCM6nJhQOC5zZBE4GkBmsNuc0F+5N 6H36aUPDIKCjPUiEr+/jiP24mYA0TyuI+sRbM/M= X-Google-Smtp-Source: AGHT+IHwzTYedwVz43rVHOvDpLVvP2jx/a4YofWFsWVFl9VgRPY9DmARThi+fpMyLo7EZKPlgFdndqRH4VZc6ILo9J0= X-Received: by 2002:a81:5bc4:0:b0:5af:bcbf:ff7d with SMTP id p187-20020a815bc4000000b005afbcbfff7dmr649063ywb.52.1698955417665; Thu, 02 Nov 2023 13:03:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 3 Nov 2023 00:03:26 +0400 Message-ID: To: Oladoyinbo Vincent Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000028c53e060930e296" Subject: Re: [PHP-DEV] Short Function Syntax From: oleksii.bulba@gmail.com (Oleksii Bulba) --00000000000028c53e060930e296 Content-Type: text/plain; charset="UTF-8" > I know that the `fn` Syntax is already used for arrow functions, but what i > am suggesting is that, can't we make `fn` to be used in naming methods in > class? (this will be optional though), Hello Oladoyinbo, Personally for me, if I see `fn` in methods instead of `function` I would expect it behave as `fn`-anonymous arrow function. E.g.: ```php class Example { public fn getMyProperty() -> $this->myProperty; } ``` What do you think about it? Best regards, Oleksii Bulba On Thu, 2 Nov 2023, 21:31 Oladoyinbo Vincent, wrote: > Hello Internals, > > I don't know maybe this discussion has been raised before, but i feel we > should re-discuss this. > > `function` syntax is kinda verbose for naming methods in class, let's take > a look at the below example: > > > ```php > > class Greet { > > public function __construct( > private string $name, > private string $city > ) {} > > private function init(): string > { > return "Hello {$this->name}, From {$this->city}"; > } > } > > ``` > > I know that the `fn` Syntax is already used for arrow functions, but what i > am suggesting is that, can't we make `fn` to be used in naming methods in > class? (this will be optional though), > > > I mean like: > > ```php > > class Greet { > > public fn __construct( > public string $name, > public string $city > ) {} > > private fn init(): string > { > return "Hello {$this->name}, From {$this->city}"; > } > } > > ``` > > The above code looks cool, readable and less verbose, what is your opinion > on this? > --00000000000028c53e060930e296--