Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123355 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 32DC91A009C for ; Sat, 18 May 2024 17:46:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1716054466; bh=iN5fDSkfICimXNLnixKs4MYPVv/q5WQtw4z1My2PUA8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=OklC9HmRwV6DeGydaM8Jid2pYuUuzOIF+zPepfQ1iSKvObOCKb0/Ri49Blr14ImNB y6uy290x374q1jt+EWwghRGjzFfpyofXgrtciFLL8PoaHtHNyFp1ZK3rSWw393z772 53YBgTpU8CT7pf4Laz+TBTXWaouuTK6d7LpDEBewkdH2I1Wu1Cw3NhpaAYtQagoGgb OAh36r1GFHOInlHkjRw4HioUR0dd93zVAg8kQ+pvlIwBUU5tBNgCDegbOW1zKYXfq7 xh7S7+AyR8eHeU+pfyuOfXWwPPfZnbovP/POfj11m3vtPQyyY7wBKx9OR76EuCI+1y wFA6MZIFTtedg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 551091807DB for ; Sat, 18 May 2024 17:47:44 +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, 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-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.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 ; Sat, 18 May 2024 17:47:43 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-51ffff16400so4893446e87.2 for ; Sat, 18 May 2024 10:46:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716054408; x=1716659208; 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=/IfMyuVsjbfSx9Q/alNvGL3TX6rf9WEbkBTELeedelk=; b=jKpEnFncdDiCF5XfR2UcAkGk2nZZ4CM+ZYabz/2YrFsG0NLJMujyoX3NpIvSy0Jh2p B6Mhmn8M1CKselfdFP8nod0Pr6mOcA0uO6Qg8nMchBPC0Qql/C4Qsnd9fw8cBnpT8hWe LV91D52V+MRafNDWV4+SqvOweNIInJVL1WpCpkyG/6Qn9MuPE1DdA8NIGebJBO/gDO3f TKJYNJY0tK3uagY7MEuehM0bvA4TPbP2Qn2WlBdeS4uS8VqDwhFsj1R+P9Qwsf9fY5BN yj6kTXEZ9PaljZSLxs4SR28W2QnJtnD8+p8edH9VuNtwIBX9cQwHbcDQQVKA572CN64p 7B2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716054408; x=1716659208; 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=/IfMyuVsjbfSx9Q/alNvGL3TX6rf9WEbkBTELeedelk=; b=W/74L0Bt+p8dEEH6YQgVgILNO4adgn4FD/8F5Zew1219ABFrmrnDIZ44eVQriJRz6l FJeqzjdqhmUR0Px29LSNkX2/ERC4mbuzNuUxxfGTVfEGjgVIosl2UZtn1xts069/ZV9m ZBB/2/BfSD73b7PL8qOVfXyS462k5u9O3d7p15B8GavPEtqAJN98Dg/o3TInqZiK4A6T xNQAXHbWctUlNQHCdtAZ4l4qLAbcSsCcc7mKugGHs5NexQmuMIWnGzN1XNoSYObW3AZL yY6izDQ00l5zuh43EHzBniYsV3Liiz7pYT7VpJbDCYgmBf7P1YDb6jCvuIY3Q8u2R4b1 1iVA== X-Gm-Message-State: AOJu0Yy2zCGRtg4UEfthxL0FM9kofmBBRhh2ZqpcpYehGkWfdgTuJQho xO/dKneSF/xvkYYOzYgq4v0kcn7VYGsOV1ujonHRPNJ/EsucWbzNuOD0EXb1yfZ0vMw/ufRDOlK mIBEzEZCfeJTo1w2dHCi8rhKSS8hNZYu4/lo= X-Google-Smtp-Source: AGHT+IF97vm+kC5f3Slv/NElQf8ckAhVSq0GYmxtXssUf+FkXKOEhNauMT+hrugWyZjKU6pPMcrDlFTBNamLNcPmTCI= X-Received: by 2002:a19:c207:0:b0:51a:f11c:81db with SMTP id 2adb3069b0e04-5220fe794b0mr19252681e87.30.1716054407665; Sat, 18 May 2024 10:46:47 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <407efbd0-2d9c-4bcb-b795-0ee326728415@heigl.org> In-Reply-To: <407efbd0-2d9c-4bcb-b795-0ee326728415@heigl.org> Date: Sat, 18 May 2024 19:46:36 +0200 Message-ID: Subject: Re: [PHP-DEV] [Discussion] "Internal" attribute and warning To: Andreas Heigl Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: landers.robert@gmail.com (Robert Landers) On Sat, May 18, 2024 at 7:38=E2=80=AFPM Andreas Heigl w= rote: > > Hey all. > > Am 18.05.24 um 16:00 schrieb Robert Landers: > > Hello internals, > > > > I've been thinking about having an "internal" attribute that will emit > > a warning if called from outside it's left-most namespace. > > > > It might look something like this: > > > > namespace MyCompany\PackageA { > > #[\Internal] function doStuff() {} > > } > > > > namespace OtherCompany\PackageB { > > \MyCompany\PackageA\doStuff(); // warning emitted > > } > > > > namespace MyCompany\PackageB { > > \MyCompany\PackageB\doStuff(); // left-most part of namespace > > matches, no warning > > } > > > > This would allow for library maintainers to mark internal constructs > > as such and provide users with feedback that they are using code that > > may be changed without any notice. > > > > Any thoughts? > I do like the idea in general of being able to mark certain things as > internal to a certain namespace. > > My question is more in the direction of: If we are not enforcing > breaking the code but merely emit a warning then that is IMO not > something that we need to implement on the language level. People will > still be able to use the internal method and just ignore the warning. I guess that depends on what you mean by "break the code." Many people turn warnings into exceptions, and for those people this will effectively break their code. Some people may choose to ignore it one way or another, but that would be up to them. The idea isn't to break people's code though, it's to provide a way to mark very-malleable APIs in libraries. Maybe, "Internal" is a bad name for this, but it's the most logical. > ,,, > (o o) > +---------------------------------------------------------ooO-(_)-Ooo-+ > | Andreas Heigl | > | mailto:andreas@heigl.org N 50=C2=B022'59.5" E 08=C2=B0= 23'58" | > | https://andreas.heigl.org | > +---------------------------------------------------------------------+ > | https://hei.gl/appointmentwithandreas | > +---------------------------------------------------------------------+ > | GPG-Key: https://hei.gl/keyandreasheiglorg | > +---------------------------------------------------------------------+ Robert Landers Software Engineer Utrecht NL