From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hartmut Goebel Subject: Changing rust variable names to follow cargo guide? Date: Sat, 25 Apr 2020 11:17:25 +0200 Message-ID: <8600ba6a-755e-0503-ddd2-ca4b49e5666d@crazy-compilers.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:55048) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSGwQ-00030j-OA for guix-devel@gnu.org; Sat, 25 Apr 2020 05:17:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jSGwO-0005DZ-LZ for guix-devel@gnu.org; Sat, 25 Apr 2020 05:17:42 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:44418) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jSGwL-0005Cp-Uo for guix-devel@gnu.org; Sat, 25 Apr 2020 05:17:38 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 498QRY6P8Bz1rvRj for ; Sat, 25 Apr 2020 11:17:29 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 498QRY6HVRz1qrWv for ; Sat, 25 Apr 2020 11:17:29 +0200 (CEST) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id BTXHSfNBTpyn for ; Sat, 25 Apr 2020 11:17:28 +0200 (CEST) Received: from hermia.goebel-consult.de (ppp-188-174-48-215.dynamic.mnet-online.de [188.174.48.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS for ; Sat, 25 Apr 2020 11:17:28 +0200 (CEST) Received: from lenashee.goebel-consult.de (lenashee.fritz.box [192.168.110.28]) by hermia.goebel-consult.de (Postfix) with ESMTP id B07B7601EB for ; Sat, 25 Apr 2020 11:17:49 +0200 (CEST) Content-Language: en-US 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: guix-devel Hi, 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): 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 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. I propose the following: 1. Variables names for rust packages shall only define the left-most non-zero digit (and any leading zeros, of course). Examples: rust-url-1, rust-url-2, rust-bytes-0.4, rust-bytes-0.5 2. Packages using caret version requirements shall refer to the respective variable. Example: requirements "url ^1.5" -> rust-url-1; "bytes ^0.4.8" -> rust-bytes-0.4 3. 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. Example 1: Some package requires "bakery =1.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  "bakery ^1.3", "rust-bakery-1" will (directly) define "bakery@1.3.0". Above rule shall go into the packaging guide in the manual. Variables shall be renamed accordingly. Rational: 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. WDTY? [1] https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#caret-requirements -- Regards Hartmut Goebel | Hartmut Goebel | h.goebel@crazy-compilers.com | | www.crazy-compilers.com | compilers which you thought are impossible |