From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 612F81396D0 for ; Sat, 9 Sep 2017 15:55:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E099C1FC0C0; Sat, 9 Sep 2017 15:54:57 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 993671FC00B for ; Sat, 9 Sep 2017 15:54:57 +0000 (UTC) Received: from pomiot (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id CB7CE341799; Sat, 9 Sep 2017 15:54:55 +0000 (UTC) Message-ID: <1504972492.29031.0.camel@gentoo.org> Subject: Re: [gentoo-dev] [PATCH] eapi7-ver.eclass: 'Early adopter' version of EAPI 7 version manip From: =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Date: Sat, 09 Sep 2017 17:54:52 +0200 In-Reply-To: <20170910030556.666c392b@katipo2.lan> References: <20170908111923.8809-1-mgorny@gentoo.org> <20170910030556.666c392b@katipo2.lan> Organization: Gentoo Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.5 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 9d8fe733-eacd-42a0-b58e-912212a4cbc4 X-Archives-Hash: 6a285b050aa5a48f221debcb98597dfd W dniu nie, 10.09.2017 o godzinie 03∶05 +1200, użytkownik Kent Fredric napisał: > On Fri, 8 Sep 2017 13:19:23 +0200 > Michał Górny wrote: > > > a. getting wider review and some real-life testing before > > the specification is set in stone, and > > Any thoughts on a function that would represent a dotted-decimal style version > as a floating point string? > > eg: > > ver_float 0.1.0 -> 0.001 > ver_float 0.10.0 -> 0.010 > ver_float 0.100.0 -> 0.100 > > That's of course *the most* generic example I can offer, but seeing > this sort of transformation is commonly needed in the world of perl, I > thought maybe now is a good time to mention something. > > Sadly, its just the sort of idea that if done wrong, would be no use. > > For instance, sometimes you want: > > ver_float 0.1.0 -> 0.0010 > > Or > > ver_float 0.1.1 -> 0.001001 > > The two key things here is to know: > > 1. How many digits each position represents > 2. The maximum number of digits to represent > > So, some ideas in that regard are: > > ver_float ${INPUT} ${PRECISION} > > Where the values per position are fixed, so: > > ver_float 0.1 3 -> 0.001 > ver_float 0.1 2 -> INVALD # fidelity loss by truncation > ver_float 0.10 2 -> 0.01 # permitted because there's no fidelity loss by truncation > ver_float 0.100 1 -> 0.1 # permitted because there's no fidelity loss by truncation > ver_float 0.100 2 -> 0.10 > ver_float 0.100 3 -> 0.100 > ver_float 0.101 1 -> INVALID # fidelity loss by truncation > > ver_float 0.1 5 -> 0.00100 > ver_float 0.1.1 5 -> INVALID, need 6 digits to represent 0.1.1 > > ver_float 0.1.1 6 -> 0.001001 > > > Or say, > > ver_float ${INPUT} ${PATTERN} > > Where "pattern" is a string like 3-3-3 indicating how to map digits to numbers > > ver_float 0.1 3 -> 0.001 > ver_float 0.1 2 -> 0.01 > ver_float 0.1 1 -> 0.1 > ver_float 0.1.1 3 -> # INVALID, no map for '.1' > ver_float 0.1.1 3-3 -> 0.001001 > ver_float 0.1.10 3-3 -> 0.001010 > ver_float 0.1.10 2-2 -> 0.0110 > ver_float 0.10.10 2-2 -> 0.1010 > ver_float 0.100.10 2-2 -> # INVALID, can't map "100" into 2 characters > > Though I suspect you'd want both features ... > > ver_float ${INPUT} ${PATTERN} ${TRUNCATION_LENGTH} > > Because we do need packages where > > 0.123.10 means 0.1231 > > Either way, much of this is probably a time wasting bad idea. > > But I thought I'd just > > ( •_•) > > ( •_•)>⌐■-■ > > (⌐■_■) > > Float it by you. > I'm not sure if there's a serious proposal behind all this but I suppose it's all just perl-specific insanity that is of no value to everyone else. -- Best regards, Michał Górny