Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123644 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 9A0851A009C for ; Sun, 16 Jun 2024 20:30:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1718569892; bh=Iv4AT9J8fPskjAj+a7PfYSPTBrTc3XVdT8j23ADyldg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YBp3DYuqBXNnLBDD7PrBsjD9CnpbXxtAa/rYHvmW6d5dHA/+PnvphxUiRWSNUJHTB PTT9M2jXZ0hiBc58Q2mNEDGTzm+zfCPTktWrB2qEwBFFUFZ4It1LCn2SAYit72Y4pm 2e4uBZvxw4UkLaeK9VjN2wwX3Q3keRZs8qAT+bV5uf3UWPPR97ufBydp5PAfsg1CuM cF4sW2j6bJxeykDxUno5L0OGcelCSF4Ej3BT+4NBs6lmXXVvPl8d2VlZ73hWu+7vKg s9bs82wZoIxy8uJryjqD7HsbqM/2KKTp2g1sDOyMA29q1K1xf1HlgRfHRY45+0kd1u 77V20sHKrJ2Hg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F0473180039 for ; Sun, 16 Jun 2024 20:31:31 +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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-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 X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 16 Jun 2024 20:31:31 +0000 (UTC) Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-63127fc434aso30991337b3.0 for ; Sun, 16 Jun 2024 13:30:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech.net; s=google; t=1718569819; x=1719174619; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Iv4AT9J8fPskjAj+a7PfYSPTBrTc3XVdT8j23ADyldg=; b=OyiH8/1xmfvUPp9Fck8syy8rsDpZN2MkhCTuVRBhB074vDGHRrG7ZJ8uZBcJqkLANI dcXLg4Py31To9rmEgHp0hikxCoxiKAlsr/UKm6A0mJ8pfjAChn78VnJ9EFmv7WdQkcic Ll7N9FOaTbzELI+k0t0JLFbvvrwz4+KGmIyFG+7j6RoAsTEcErdaHZUoTTjhvE21eMDj oR5pw/zeQMiB5cwIaKJpkY8FPY3dkN42PJoA4Jqowu7Cg82fhQ11i07WCbBty1pCwhhQ ITsnayLgfngRLYsqYuyBk0Z6dhftSQdJwgxBUtHGf23mkwz98YPBk4EhpSyAQcbJ5nGJ eFuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718569819; x=1719174619; h=content-transfer-encoding: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=Iv4AT9J8fPskjAj+a7PfYSPTBrTc3XVdT8j23ADyldg=; b=Ek1d3pOFx4GGkkVuYGJY4v9fXfhHHIubg6T7Jauwa+qYqWaFtLymxSAkUpJTovuXxC 44Me1znoT5jci45vhohANBmiScUzMn9VI+PFAA7TLmbPS7TlAQOKoRYriUH/UKFYdEJ7 57BQQA+3USDWyulvC7LbdFa0sVLafIjxziIcPCTkFnGo8dmOPNHyyer/O4NFJLS7Z5BE nPveGnk3HPCHAwKX5mr20GYv6uSiWhJfgYnahkkCQVSPtbzQRuVn13gzxONRwElSfH8e Zcw43XMsUU/AS0Fd2ZHCw3cNZxioWEDgHS+fJ2oH8ZcNLCIkFGDfPndBXNH1ZqkLgiVI w2/w== X-Gm-Message-State: AOJu0YzSHA88va6mbRnlZ8MiezLCX5mVMywOoE06WJjLeHSeRm0oXLr4 DI1bxxKV7UK6knhlQWIInGZ6lPKTmlkvq+FPl3v8kYCUqxb2WcVe3dWFmI+Bp9SALMa0NhjOMH4 U9E8f2RL6q/GrS6ydVgWsm8xp6nOJwaf8ECwLWmVhbg5qtTvQbgfvqQ== X-Google-Smtp-Source: AGHT+IFV0FhYTFQ+vgHuTXru6GLCC5EuCzio/qU6JuFTNUeIg1TJ1Jp5NoiN4vXdaAmUlSEwelg0Jwxyk0gfH29JOYE= X-Received: by 2002:a05:690c:385:b0:62f:aaaa:187a with SMTP id 00721157ae682-63222856cfbmr79807167b3.14.1718569819247; Sun, 16 Jun 2024 13:30:19 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <0cf69a14-f1b5-4077-9d91-d7b579485eec@scriptfusion.com> <936e1aa3-48cc-4552-9f68-676ebcdeb596@rwec.co.uk> <1fc2f2d0-718f-45ec-8968-b66a1bde686e@scriptfusion.com> <4e439377-5c20-40d7-bb99-5d0ac6c348e9@rwec.co.uk> In-Reply-To: Date: Sun, 16 Jun 2024 22:30:08 +0200 Message-ID: Subject: Re: [PHP-DEV] Static class To: "Rowan Tommins [IMSoP]" Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: andreas@dqxtech.net (Andreas Hennings) On Sun, 16 Jun 2024 at 20:08, Rowan Tommins [IMSoP] wrote: > > On 16/06/2024 18:54, Andreas Hennings wrote: > > Yes, the possibility for namespace part imports exists. > Unfortunately these namespace imports usually need to be set up > manually, whereas the regular class or function import has better > automatic support from the IDE. > Also, namespace fragments are often more generic than function names, > so more likely to need a custom alias. > > > That's why I said it was tricky: the language doesn't prevent IDEs sugges= ting different imports; nor does it require you to name namespace fragments= differently from classes; but that's what happens in practice. Right. The main thing here would be to have a 90% deterministic way to generate the imports. We want to avoid meaningless choices a developer needs to make case by case= . I see some difficulties here, but there are probably ways to handle it. > So to what extent do we build the language based on how it *can* be used,= and to what extent do we build it based on how it *is* used? What if that = usage changes over time? What if we add more ways to do it, and those aren'= t used either? I don't think there's an easy answer. It depends how disruptive the change is. E.g. symfony has a Yaml class with only class constants and static methods. https://github.com/symfony/symfony/blob/35890e1ca999cb92d7b20c81bc07cdc2f17= b7bb4/src/Symfony/Component/Yaml/Yaml.php We can argue whether this is good or bad. Or we can just slap a "static" modifier on the class, so that developers know what to expect. This does not prevent future refactoring, where these methods might be converted to functions. Btw, even with only the class constants left, this would still be an all-static class.