From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Philippe Vaucher Newsgroups: gmane.emacs.devel Subject: Re: Imports / inclusion of s.el into Emacs Date: Sun, 3 May 2020 15:47:13 +0200 Message-ID: References: <87ftchy0go.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000717dde05a4bea8e6" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="73960"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , Stefan Monnier , Richard Stallman , Emacs developers To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 03 15:48:13 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jVEyb-000J7r-5z for ged-emacs-devel@m.gmane-mx.org; Sun, 03 May 2020 15:48:13 +0200 Original-Received: from localhost ([::1]:34822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVEya-000480-9U for ged-emacs-devel@m.gmane-mx.org; Sun, 03 May 2020 09:48:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVEy7-0003dW-EM for emacs-devel@gnu.org; Sun, 03 May 2020 09:47:43 -0400 Original-Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]:46054) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jVEy6-0002lj-Do; Sun, 03 May 2020 09:47:43 -0400 Original-Received: by mail-lf1-x134.google.com with SMTP id a4so1004227lfh.12; Sun, 03 May 2020 06:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lOd7btyojj+KU8fQ3F5KsaJ8KYeDGHUTXn2X4ShBdYU=; b=P4rgfmRCSn6Z84szc1pFw9KGVqLXTSws2fV0a8c9v0PbMUPsFbeRuiWWghm5HUbaK5 6BKy6q2MH9BzZOF5aIGeT69AVa2x87Y3AzEIF3jg0/bhEuo3uLCQqJTo7+uXrn/IIUo3 qeSrpiaS9YiqtA9T2O3GJWDTS+o2Yg9fGu/GnBTJYaNv1KYR8ShwPoPPGrbb/46M1Ban Jtc8H0XXB52lYh/i+EVpl6m22kWnXdNlo7uGEmqwjCmm6ULO9Yp/yRBuuoCG9iY2waoE bdmQBRmle5Rt3hpZNqzUkPGAt0MIgcRrWfvriP/aFaCX7MAR1ziiNt5Jx0BEhRuY81P0 FNRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lOd7btyojj+KU8fQ3F5KsaJ8KYeDGHUTXn2X4ShBdYU=; b=JYeZ/txFkc3lKYqOU00OjXPjdPuK4lB+IMmhxrR7tXGhtOBU67+M7qNSYH/5hjrlC9 5EDoKG1VGpmXFVPQ/AnsBzuC2WGlalyD9zUbUyfe33etrJCZPN0lARo0Gvqy0lWKRmcF LtcAG3cBIROBlloRwTE5O31kQbfSUpx+mVTwX28EKIQnNIuEJoc4NFmQZdQCoeX0SbAJ GImyzG63n+JRKWtzPGeGYYUkBC5FZ72z6swGhRqTMrTUfFJk9Hdrqb9AtLL898v/p03u BhXUgadSzUOT16eEiW6nk1mDEhmdgqaNBz05e6zfvDm+CL3Qw67xu2QkaWotAm0CQ91+ iu7g== X-Gm-Message-State: AGi0PuaEJk9RWIPt2/4rKzicPRuTMbE5oOjsmkkFh74FuzuYp68b4NFx bN5jibHg8JBQWT0bNH9gYrfFCNcl+bZtTJyPt1k= X-Google-Smtp-Source: APiQypJ5I5PBH8H4DKxky3NjfvREnE9j6SyUVATgetcAtqI7Yb0JIn8jBY+8TPX0bP+Jg4NODcDfOdPLuS2D6MZ9BdI= X-Received: by 2002:ac2:4248:: with SMTP id m8mr8520146lfl.211.1588513660303; Sun, 03 May 2020 06:47:40 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=philippe.vaucher@gmail.com; helo=mail-lf1-x134.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:248683 Archived-At: --000000000000717dde05a4bea8e6 Content-Type: text/plain; charset="UTF-8" >> split-string aliased as string-split >> downcase aliased as string-downcase >> upcase aliased as string-upcase >> format aliased as string-format >> concat aliased as string-concat >Don't do this. Just learn these 5 names, or use apropos, as > has been suggested. Just curious, if these were to be introduced today, would you also name them that way? What possible genericity is there about downcase/upcase? Okay they work on strings and on chars, but it's pretty clear their topic is "characters" (string) no? > Check out http://www.lispworks.com/documentation/HyperSpec/Body/f_stg_up.htm and http://www.lispworks.com/documentation/HyperSpec/Body/c_string.htm > Do you think this organization would be useful? What if it had a cool > font and some cool logos? :-) I ask because that put me off at first, it > looked mouldy.) Yes, that'd be very useful and it's more or less what we are asking to be able to do. Again curious, do you think they made a mistake when they named it `string-downcase` there and not `downcase`? >> s-truncate (len s) > truncate-string-to-width (I got there with apropos truncate.*string btw). Okay then let's alias that to string-truncate. >> s-left (len s) >subseq >> s-right (len s) > Add an "from-end" arg to subseq? Why is there substring if there is subseq then? >> s-repeat (num s) > (cl-loop repeat num concat s) What if I don't know cl (like I a significant number of package authors) ? >> s-capitalize (s) > capitalize, also works for chars. Alias it to string-capitalize :-) >> s-reverse (s) > reverse, also works for sequences Ah, this one I didn't think worked on strings. Thought you have to split, reverse then join. I agree this can be left as a generic algorithm. >> s-contains-p (needle s &optional ignore-case) > string-match-p That can work, tho the mental path of having to do a regexp match while regexp-quoting the string just to do a plain text search feels very inneficient. >> s-blank-p (s) > ugh. nil is a string? "is the string blank?" is a concept in many languages, but I understand it can be surprising at first. The idea is that very often when validating user input you filter for nil, empy string or trimmed string. --000000000000717dde05a4bea8e6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
>> split-string aliased as string-split
>> = downcase aliased as string-downcase
>> upcase aliased as string-up= case
>> format aliased as string-format
>> concat aliased= as string-concat

>Don't do this.=C2=A0 Just learn these 5 na= mes, or use apropos, as
> has been suggested.

Just= curious, if these were to be introduced today, would you also name them th= at way? What possible genericity is there about downcase/upcase? Okay they = work on strings and on chars, but it's pretty clear their topic is &quo= t;characters" (string) no?=C2=A0


> Che= ck out http://www.lispworks.com/documentation/HyperSp= ec/Body/f_stg_up.htm and http://www.lispworks.com= /documentation/HyperSpec/Body/c_string.htm

> Do you think thi= s organization would be useful? What if it had a cool
> font and some= cool logos? :-) =C2=A0I ask because that put me off at first, it
> l= ooked mouldy.)

Yes, that'd be very useful and = it's more or less what we are asking to be able to do. Again curious, d= o you think they made a mistake when they named it `string-downcase` there = and not `downcase`?


>> s-truncate (len s)
> t= runcate-string-to-width (I got there with apropos truncate.*string btw).

Okay then let's alias that to string-truncate.


>> s-left (len s)
>subseq>> s-right (len s)
> Add an "from-end" arg to subseq= ?

Why is there substring if there is subseq then?<= /div>


>> s-repeat (num s)
> (cl-loop repeat num con= cat s)

What if I don't know cl (like I a signi= ficant number of package authors) ?


>> s-capitalize= (s)
> capitalize, =C2=A0also works for chars.

Alias it to string-capitalize :-)


>> s-reverse (= s)
> reverse, also works for sequences

Ah, t= his one I didn't think worked on strings. Thought you have to split, re= verse then join. I agree this can be left as a generic algorithm.


>> s-contains-p (needle s &optional ignore-case)
>= string-match-p

That can work, tho the mental path= of having to do a regexp match while regexp-quoting the string just to do = a=C2=A0plain text search feels very inneficient.


>>= s-blank-p (s)
> ugh. nil is a string?

"= ;is the string blank?" is a concept in many languages, but I understan= d it can be surprising at first. The idea is that very often when validatin= g user input you filter for nil, empy string or trimmed string.
--000000000000717dde05a4bea8e6--