From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Decoded time accessors Date: Sun, 07 Jul 2019 21:33:19 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="144856"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 07 21:33:36 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hkCui-000bY5-MR for ged-emacs-devel@m.gmane.org; Sun, 07 Jul 2019 21:33:32 +0200 Original-Received: from localhost ([::1]:36720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkCuh-0005WZ-I1 for ged-emacs-devel@m.gmane.org; Sun, 07 Jul 2019 15:33:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49737) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkCuc-0005W9-8o for emacs-devel@gnu.org; Sun, 07 Jul 2019 15:33:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hkCua-0003cG-4x for emacs-devel@gnu.org; Sun, 07 Jul 2019 15:33:26 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:38354) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hkCuZ-0003Wb-TY for emacs-devel@gnu.org; Sun, 07 Jul 2019 15:33:24 -0400 Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hkCuV-0001cP-H0 for emacs-devel@gnu.org; Sun, 07 Jul 2019 21:33:21 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEXt9u+vvLza4dX2/fj0 +vJLVlwEBgn+//7p8OX7/v3lE656AAACYUlEQVQ4jV2Usa/TMBDG3Rakvu2daUUZ7ZdKYXsiQpCx VYaMuMgBxg6xGCsYQrcXq0+YuUPJf8vd2el74sb75bPvzt9FPAiKeaDQGMFrDhEBBwMflNYKJGdm RcEyr6UOwSupGVQFBRG/bDWdKCWBYsAoivvp7XTpWuWD7yUgKDF9RDJp2sZF4FkxdMehG4oes44A HuVZ0VGcJy4FUNk7mcBxOeadwbxCAASGtXsCdQhrLJfAz/i9Bd1ERZCkGFTM72dCTBtn8kBDQWDj Ee1dcS/Eo9sh6EFLECn/qqTup80uQwXIK/hannkqjcxwKEBHRcHNMDDpdYYtAoAh0MIdtn8+k8Sz AiePwNxQjzRIBA+ZqvEor0VjLtx8hwqsS2Sb2gMWLOKwkEQQMv3CwwpBN4KBwNxn4cSvfxUM8ZKw 6E81g9+JXEZQVTU+O4j2bSLUCRoir5J9XLsaASnmuiJJoD7crhsbwbJ8zWcxcItUFZWlN1lVJYVr /9BRRVRsF0/AfXoOTs9Ae8HOGcz9Nqv6fATuDd5R8Hj1x8XGSLzc5vS4e3LjmYaottnW9qi4dD/Y NmUEc/VuVSkcL82K3fn5XHK1UFSVNXGI79k+fLdXFvtTuCcEouNucSJzsAiq3kTQHbjkmZgsrbXZ /8AZ/DwCckN8qOReDpqIAS0+MOHC2gTqYI0Urxm8TFuQQC+l+MJg26T1ACCwNiC+dQOCv2mngIAO j1aJ7wx+KZK0hkCNvw2pxJ6NeFBLi2tEsdhCjmsookMPfmlz/IUQUGhEOwIwBDSDHgGuM5TkBGuv ilUPEn31D5aGV7LYzDJ5AAAAAElFTkSuQmCC X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 80.91.231.51 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:238394 Archived-At: A while back we added accessors to the return value from `file-attributes' (i.e., `file-attribute-size' etc), and I think that was a readability win. I think we should do the same for the return value for `decode-time', but do it as settable values instead: --- decode-time is a built-in function in =E2=80=98C source code=E2=80=99. (decode-time &optional TIME ZONE) Probably introduced at or before Emacs version 19.29. This function does not change global state, including the match data. Decode a time value as (SEC MINUTE HOUR DAY MONTH YEAR DOW DST UTCOFF). --- So you could do something like (let ((decoded (decode-time (parse-time-string ...)))) (setf (decoded-time-year decoded) 1975) (apply #'encode-time decoded)) or whatever. I hate reading code that says (elt decoded 5) and then have to look up the doc string and then count to be able to tell what it's doing... Does this sound like a good idea? And if so, what should the name of these accessors be? `decoded-time-' is clear, but perhaps a mouthful... --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no