From mboxrd@z Thu Jan 1 00:00:00 1970 From: Efraim Flashner Subject: Re: Changing rust variable names to follow cargo guide? Date: Sun, 26 Apr 2020 17:22:42 +0300 Message-ID: <20200426142242.GC5243@E5400> References: <8600ba6a-755e-0503-ddd2-ca4b49e5666d@crazy-compilers.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="RIYY1s2vRbPFwWeW" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:56880) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSiCE-0002qD-Bu for guix-devel@gnu.org; Sun, 26 Apr 2020 10:23:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jSiCC-0003wf-T7 for guix-devel@gnu.org; Sun, 26 Apr 2020 10:23:50 -0400 Received: from flashner.co.il ([178.62.234.194]:43630) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSiCC-0002oG-Cm for guix-devel@gnu.org; Sun, 26 Apr 2020 10:23:48 -0400 Content-Disposition: inline In-Reply-To: <8600ba6a-755e-0503-ddd2-ca4b49e5666d@crazy-compilers.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane-mx.org@gnu.org Sender: "Guix-devel" To: Hartmut Goebel Cc: guix-devel --RIYY1s2vRbPFwWeW Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 25, 2020 at 11:17:25AM +0200, Hartmut Goebel wrote: > Hi, >=20 > in Cargo (to my experience) most versions are defined as "caret > versions, specifying the minimum version. According to the Cargo Book > these version dependence [1] are defined like this (my words): >=20 > Newer version of a package can be used, as long as the left-most > non-zero digit in the version keeps the same. This means: If a package > requires ^1.3, it might also use 1.4, 1.5, etc. Whereas a package > requiring ^0.5.7 must only use 0.5.8, etc. but not 0.6.x >=20 > This it should be save to update e.g. unicode-segmentation 1.3 to 1.6 - > as long as no package requires an exact version. >=20 > I propose the following: >=20 > 1. >=20 > Variables names for rust packages shall only define the left-most > non-zero digit (and any leading zeros, of course). >=20 > Examples: rust-url-1, rust-url-2, rust-bytes-0.4, rust-bytes-0.5 >=20 > 2. >=20 > Packages using caret version requirements shall refer to the > respective variable. >=20 > Example: requirements "url ^1.5" -> rust-url-1; "bytes ^0.4.8" -> > rust-bytes-0.4 >=20 > 3. >=20 > If a package requires e specific version, the variable shall contain > this specific version and a "alias define" shall refer to this > package if it is the highes "caret" version in guix. >=20 > Example 1: Some package requires "bakery =3D1.2", with "bakery" not > being in guix yet. Then the new package "bakery@1.2.3" will be > defined as "rust-bakery-1.2" and additionally "(define-public > rust-bakery-1 rust-bakery-1.2") > Example 2: Later, if some package requires=C2=A0 "bakery ^1.3", > "rust-bakery-1" will (directly) define "bakery@1.3.0". >=20 > Above rule shall go into the packaging guide in the manual. Variables > shall be renamed accordingly. >=20 > Rational: >=20 > 1. Using only the left-most non-zero digit in the variable name follows > the version scheme intended by Cargo. > 2. Referring to variable names build like this eases updating, since > only the package itself needs to be updated, not the all occurrences > of the variable name. > 3. Distinguishing in dependencies between variable names build like > this and more specific ones makes it easy to spot whether some > package requires a *specific* version of another package, or whether > it is (expected to be) save to upgrade the other package. >=20 > WDTY? >=20 > [1] > https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#ca= ret-requirements >=20 I like this idea. It makes updating rust crates easier and removes a bunch of extra ones that aren't actually needed. --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --RIYY1s2vRbPFwWeW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl6lmS8ACgkQQarn3Mo9 g1EbERAAwOZ8urUmTogFg7fk7QMb2SbjRD8A0P+a2/RB3WzZ9T+cWM9tsdbH+p/O BmPtTwrQk1vnlr4x4TyPmUQH/kmQx1aOtiBVcjuBfaXAeEonlBwYIWtqe2e3grK+ PXiDMr+ZvfTI7qDfacuGp2cxYyML7W9N4hQWz8f56qy35dYLV0314dft5GYFoONE plhY0gzuLjQHQvb5Ui7ZnvV7AOSPFk40jrAfOJzfMSvBQkfAwft0l2PjyA/zflKd KbSA712y52jMv3FANEuMbCa8pjOFwGvMxM/RyuJ1rNKqJ4tdF0kzzNDaKejT80D/ 9XjxYHVQhswD7SBb2mi37s1KOT/ONdHxV9NY59xykyqwvXD3I124E0h9h2hO4b1Z w1VtfPHnOViizO4hN7kQHbnNfcqGPRvMHtTfy2kc9kZBCiEm1y+b2oc7dEqoMBLK +Gr9B0f0NWhiaP64Yd5+EveVDvHbMlYO8MMsYrxcQhz5VdnoTUyfzUOwoijLIpbs 1yfm3Cgaqhan8j0+9liZ6/dIOPxKNiqotu7zPyM2ksXsUSSuPZoBUjHgXlYai9o4 9ln/RBO/dex+RlgHdeQb1jc0sDxgQrocVciLcmu24jic6qVoy/FF7bgOK+vBX0Lz P1YrIe+3zFpEmXSRuCwU2y4TuXFFt/IlYGCXU6Co/+1p8/CW5Ao= =nhNU -----END PGP SIGNATURE----- --RIYY1s2vRbPFwWeW--