Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124293 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 2777A1A009C for ; Mon, 8 Jul 2024 17:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720461302; bh=bMKsA+RWSraJpTQMjxIU1eng/9RbQrDXSA/mc9ouPbA=; h=Date:Subject:To:References:From:Cc:In-Reply-To:From; b=ODb5tgK0VgIePqyRjLHcVO0K7aUX0/dQgxjWNKJA/RhlghbAoTG7TzVtluboqZLfM kCcc49Gv0XzD8KDdtBOWhpqgstgDi8QxYdDLO89IDq9Uh3Wht7VZgHqjDQpvE28RiJ OfkgarLSciNesprOFLZpAoU0eVPAFV3hf+M2OlBs2CUXN7yob1Re3WnzxeAVEe9Mr1 yM/AwGmTLW7neuXjfWyzhqyCtTY/YgPk/A8nu0k/V/a0b++ZzVGvJ0iGLxvaNl+nnJ S8q+atVhGYCR7ODeLt+7Yg/tAQSQo24uDvBaFuUZzcCcRiOWCSy4aWI99TSoCUoLcG gNDeMymyw9kww== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8C63E1806BB for ; Mon, 8 Jul 2024 17:55:01 +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,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-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 ; Mon, 8 Jul 2024 17:55:01 +0000 (UTC) Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2eaafda3b5cso41926271fa.3 for ; Mon, 08 Jul 2024 10:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scriptfusion-com.20230601.gappssmtp.com; s=20230601; t=1720461215; x=1721066015; darn=lists.php.net; h=in-reply-to:cc:from:content-language:references:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=VriOY+AxMNtJSV9QSKObEdxEw+LUAlV+AghiO6dqxqU=; b=H1z13J7NQw3bTF/AxeRY8xRay1JkJd1ObwIyTB06hXQ6TR5qfKgYipks6Ec9PDFe8u cZtrKFpwo0vbKP8DbfOOERTK+P5UF2RECJRwU3fvtdeWItXQcZSSDiH8PILtlZCLC5wt 0mxI1sc34Nw3E8kfClCEys1B77Dz6BpTgKUn9Ny0hWQmRdMmhhZZ+3iffeBrCuX06Kwn 4bGVqNDNObxUh4OIdbZgU+t6vAtZtR6UfItd4Y/wTA/M8Krm2Gu+b00+zyj2GI1R8HC0 PBa5SF2s8BM9+WK2R2NuJmdx6rhXqIlvwgJWfpeLCEi/NrisdII+2BkgxAWJgO9kKFnV ckZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720461215; x=1721066015; h=in-reply-to:cc:from:content-language:references:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=VriOY+AxMNtJSV9QSKObEdxEw+LUAlV+AghiO6dqxqU=; b=vzNwHwF9OCPV9lY0j3EpKzGhjmAVFdY59AHKRFzzCGjLe/zFO8FStOnTSR31CtDPqE fex3EBwCHOuf2UitD+EGui8VffoTOOqmUsAwZZ4umHyfQbwP1Rs1S4hsSlfaCesjNLjd n2LhG80jThCYOSFxK3lVO9NVQ6OQ7TBot2hxNNCs1D8sbewclaLQo6cUAtgJ7dwpkvOi vYQuNTxXJHBmb/4lasGtDZbT6F9hIzNhGEutN6rOQR1oJ79IxG64oidzbwMv+hHHTjL3 O0bLjcvf21haMA3gPtum4nynD2Ul7i3sfkF0gv7C5vcDR7X5sZbHS3PToBGRh2ikl5TP dsKw== X-Forwarded-Encrypted: i=1; AJvYcCXwULMzXFD4kqJkKEr1RFY8dUYPz+hmKV91QOhrTRpNmyuHNyhqwJm8VJOmN3tnDXPz7yIBhAQ2DdJ6mt23GAcBC8F2v71hLA== X-Gm-Message-State: AOJu0YzPRvSkPesCDn82NRoy+Yn146soswkIMiNaUPzPjhLZzFjjcGBq etEeLaKhZ07qQOgLKOQetw0mrbNASgcShBgO/btM16ZMn7vkZ/da/Ih+VjQanxY= X-Google-Smtp-Source: AGHT+IE8EB9GWzbLro28W8c67xpiMznAZTpZbGEZatY9Y1OKMsy3Uf/+GzIq853FmBQZO27q2wIZZA== X-Received: by 2002:a2e:8744:0:b0:2eb:ed3a:9c65 with SMTP id 38308e7fff4ca-2eeb30db02bmr2629941fa.15.1720461214572; Mon, 08 Jul 2024 10:53:34 -0700 (PDT) Received: from ?IPV6:2a01:4b00:bf09:5101:2168:d210:20e5:ad98? ([2a01:4b00:bf09:5101:2168:d210:20e5:ad98]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4266c859e5bsm34690805e9.9.2024.07.08.10.53.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Jul 2024 10:53:34 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------arRwxjjJD8Dfkedp0KQE0DMu" Message-ID: <037a5aaf-9652-45e4-8848-ed59bffffb6c@scriptfusion.com> Date: Mon, 8 Jul 2024 18:53:32 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Static class To: =?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?= References: <743774dd-2281-458d-b0fa-d3e8806a3516@scriptfusion.com> <3B6AF286-642C-4850-9577-B10049CE4C1E@koalephant.com> <30320e4c-aa99-4fb6-b475-d21f5fe85a26@scriptfusion.com> Content-Language: en-GB Cc: Stephen Reay , Mike Schinkel , php internals In-Reply-To: From: bilge@scriptfusion.com (Bilge) This is a multi-part message in MIME format. --------------arRwxjjJD8Dfkedp0KQE0DMu Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 08/07/2024 15:13, Alexandru Pătrănescu wrote: > But I understand that once a class is static, all the chain of > inheritance should be made of static classes, going up or down (and I > would also think we can add interfaces and traits.). Correct. > If interfaces are not included, do we allow implementing an interface? Yes. > If we allow implementing an interface, should that interface contain > only static members? Yes. You can technically implement an interface that has instance methods, but you will either: get a compile-time error that you didn't implement the instance method, or a compile-time error that you didn't mark the (instance) method as static in a static class. So although you won't get an error about implementing the interface itself, you will be forced to not implement an interface containing any instance methods in a static class, by one of those two (somewhat indirect) errors. > Same for traits. Yes > For completeness, if we think that the static keyword on a class-level > entity means that it will allow only static members on that entity, > all class-level entities should be able to be marked as "static".: I understand that sentiment, however I'm still not going to entertain it right now because this RFC seems to have a tenuous chance of passing at best. I should think we will be lucky to get 50% of the vote, let alone the 66% required to pass, and any further (unnecessary) language changes, such as introducing `static interface` or `static trait`s will probably lower those odds. I'm sorry it's like that, but that's how the landscape looks to me. But not to be too disheartened; both of those things can be trivially added in a follow-up PR if there is a strong desire. That is, accepting this RFC in no way precludes the possibility of going down that road later. Cheers, Bilge --------------arRwxjjJD8Dfkedp0KQE0DMu Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 08/07/2024 15:13, Alexandru Pătrănescu wrote:
But I understand that once a class is static, all the chain of inheritance should be made of static classes, going up or down (and I would also think we can add interfaces and traits.).
Correct.
If interfaces are not included, do we allow implementing an interface?
Yes.
If we allow implementing an interface, should that interface contain only static members?
Yes. You can technically implement an interface that has instance methods, but you will either: get a compile-time error that you didn't implement the instance method, or a compile-time error that you didn't mark the (instance) method as static in a static class. So although you won't get an error about implementing the interface itself, you will be forced to not implement an interface containing any instance methods in a static class, by one of those two (somewhat indirect) errors.
Same for traits.
Yes
For completeness, if we think that the static keyword on a class-level entity means that it will allow only static members on that entity, all class-level entities should be able to be marked as "static".:

I understand that sentiment, however I'm still not going to entertain it right now because this RFC seems to have a tenuous chance of passing at best. I should think we will be lucky to get 50% of the vote, let alone the 66% required to pass, and any further (unnecessary) language changes, such as introducing `static interface` or `static trait`s will probably lower those odds. I'm sorry it's like that, but that's how the landscape looks to me. But not to be too disheartened; both of those things can be trivially added in a follow-up PR if there is a strong desire. That is, accepting this RFC in no way precludes the possibility of going down that road later.

Cheers,
Bilge

--------------arRwxjjJD8Dfkedp0KQE0DMu--