From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id kFuDIvApcGc0bAAAqHPOHw:P1 (envelope-from ) for ; Sat, 28 Dec 2024 16:40:16 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id kFuDIvApcGc0bAAAqHPOHw (envelope-from ) for ; Sat, 28 Dec 2024 17:40:16 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=cSAylFNO; dkim=fail ("headers rsa verify failed") header.d=recursewithless.net header.s=fm1 header.b=yUDfQXoP; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b="tUFitn/P"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=recursewithless.net (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1735404016; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=FRAcQKPY8q7aZ/rAGlNsIhaqe12wlkTiE8c1jISoSa4=; b=cBp2PWEh4kTAHZ0E/9maE5YDDGDfRN55im+hEHjQihHEEdZX0qxz3TTJnYicXEHJbaIgKi cGOeRQqW2QPP1GlPG9lt8rDFaxKTSYvh0Ao0lYeyeghl/YZ2XBuEMKHMKJbDwqW9FxT/sS mCnVFi1pXR2ctAEZVmBM7nSQQGXQsvZ/SREhvrB7/t8AuUb+cD8kL6o3jtGGrIvWtGGqPp hHW+KTfeO9vs89l+WTk7uXFzR70VYIOi8OPV0jXab9iuqxpyTuF9kO1ofPJEw2LwcSuqyS Hkc88cjpkTfLjnzI5xQv97jQDZcWraEsHORYRFzIDR4/xcRLWtFH+uvd3t/eqQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=cSAylFNO; dkim=fail ("headers rsa verify failed") header.d=recursewithless.net header.s=fm1 header.b=yUDfQXoP; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b="tUFitn/P"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=recursewithless.net (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1735404016; a=rsa-sha256; cv=none; b=XPtUOQP8Vs8MCSYU1jbMpPqQhMVyobYCen3mZFPyYn5NhQ/QTFD8wTIPhkacN6UNpambiH Ls5aElgpinANAKTr1V7sySeJJmcaHbNtS0XLTsnM7llRKdgzaS2H/W67OSua7fhuCVpRNp qH9QiJ5itEgRgmvKm7RA+ics/mhQ6mANEfWGMce+p2LSsSuoSKpYw73XlqB9MtSJCePQ30 lVqcK50rgFVTOX4o+hnoGgGfSR3PXMDJb8RfJK9g0z7ermPiRZXwdIWYUARC2SWpAShK0L 8N/fcnNoKFWsld9k+Sb96nMefMS0RWdfd7LaMzfELTZg18wLLjUvgTT95Su86Q== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1EB6E1C95 for ; Sat, 28 Dec 2024 17:40:16 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRZaS-0006MK-3h; Sat, 28 Dec 2024 11:22:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRZBY-0007Ck-C9 for guix-patches@gnu.org; Sat, 28 Dec 2024 10:57:05 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tRZBW-0006kE-Iw for guix-patches@gnu.org; Sat, 28 Dec 2024 10:57:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=FRAcQKPY8q7aZ/rAGlNsIhaqe12wlkTiE8c1jISoSa4=; b=cSAylFNOjYl2Cwuguwd8zy43c/5RJyI6VW4JU8DoMUA2aq1RylRe4qLglOWjiNQ2xId+zv2VWug1zCSX7lBelyxSPL9yF4/wvd/AKJWBRd/LIPK2Q2f3p56iwiWK02nWk+jCQKzK8TsOBfOodfDRY2DUZYN5byHFKY6SvNZm0OmGG2cskctnIt4gXi/W202LAxCwmOo+N7sMJdb4z/Woh6/zKsdIladuDlm/fe5esxKaR6veT5KC4hpp3MmK/2xodyicAn1CudJox9DcYsdMxg8AydQtL6cjkIhqCq9mtTHmYAf8avWEGl1K+tnXlpjB0cKK3k2Qx9Pfmso7z+MTSQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tRZBW-00041i-Ad for guix-patches@gnu.org; Sat, 28 Dec 2024 10:57:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74689] [PATCH] Add predicates for decoded times and time deltas Resent-From: Richard Lawrence Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 28 Dec 2024 15:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74689 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Paul Eggert Cc: 74689@debbugs.gnu.org Received: via spool by 74689-submit@debbugs.gnu.org id=B74689.173540141715468 (code B ref 74689); Sat, 28 Dec 2024 15:57:02 +0000 Received: (at 74689) by debbugs.gnu.org; 28 Dec 2024 15:56:57 +0000 Received: from localhost ([127.0.0.1]:52373 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRZBR-00041P-E1 for submit@debbugs.gnu.org; Sat, 28 Dec 2024 10:56:57 -0500 Received: from fhigh-b8-smtp.messagingengine.com ([202.12.124.159]:53643) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRZBO-000415-CU for 74689@debbugs.gnu.org; Sat, 28 Dec 2024 10:56:55 -0500 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.stl.internal (Postfix) with ESMTP id C4EA125400D3; Sat, 28 Dec 2024 10:56:48 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Sat, 28 Dec 2024 10:56:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= recursewithless.net; h=cc:cc:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1735401408; x=1735487808; bh=FRAcQKPY8q7aZ/rAGlNsIhaqe12wlkTiE8c1jISoSa4=; b= yUDfQXoPmtRa397/GhTrUNrUpouxonAGFK8nyxIzaq0keLVLk/SUT4F6iAKIoUUq FVYBGofXDcbwvVWCzcyqxMy9exZsqY/q2+mh7m6o81QcsCUGoYtxkiHR1lcRYbsk CuN1OSnLcoTHtwMUvgS/KaqP42uv2rjC+GQuF95U4FsYynr6M/WDs8KYYtTlB3Py iWokKgpaBsZhMrdt5D65gNHfjDBz3vogonqqaFBVYzwcqxEn+wsbPowTb2okbAI3 WxPMxmL6pHLwMnOGChRzr+2FXpIkPP3ktJhtXS3j9+rCrTo5hVM1L4a6NojwobUV DlHx0ZkI0wUE126SH5qcyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1735401408; x=1735487808; bh=FRAcQKPY8q7aZ/rAGlNsIhaqe12wlkTiE8c 1jISoSa4=; b=tUFitn/PVmuDOCJz49ZxIWTIyrKTL2rIMlTd+cq1cwJmNSeuKj3 f+KXY4I7q1jdR0roPRNjsN/+1DfhBX1UelJ6KEyd9ftXlGxl5VYeAS6C7EB2Fop7 ZiQKudAoqcTQawuAma0IaqXYQMk11Kc1XkU/aTl6ESnbsQWXb+v1l3FCWXu59bRX FcaGvjKTk0+c2IoGHffwGHyND4Mao4cKhumpJoVqGGdLSsPqPfkkyZOLzWqmSaaf 2Pdas7IsRFHIM4Ze/rH6aTFqx2JLxhV+7sSDstPnqyl2XLUNLzbsG5nVRiGVHKm4 +hXKIfOI0dKzAga8EC6OeI/n+fHWeOiFloA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddvvddgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehttdertddttddtnecu hfhrohhmpeftihgthhgrrhguucfnrgifrhgvnhgtvgcuoehrfihlsehrvggtuhhrshgvfi hithhhlhgvshhsrdhnvghtqeenucggtffrrghtthgvrhhnpeefueffvdeffeeftdeutdfg jeettdduveduudefjedtkeejgfehhedvgffgffduhfenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrfihlsehrvggtuhhrshgvfihithhhlhgv shhsrdhnvghtpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtph htthhopegvghhgvghrthestghsrdhutghlrgdrvgguuhdprhgtphhtthhopeejgeeikeel seguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: if7394488:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 28 Dec 2024 10:56:47 -0500 (EST) From: Richard Lawrence In-Reply-To: <468ca0ab-a4aa-41ed-8f6c-260940f3f9f3@cs.ucla.edu> References: <468ca0ab-a4aa-41ed-8f6c-260940f3f9f3@cs.ucla.edu> Date: Sat, 28 Dec 2024 16:56:39 +0100 Message-ID: <875xn3vm14.fsf@recursewithless.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Sat, 28 Dec 2024 11:22:46 -0500 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: 2.74 X-Spam-Score: 2.74 X-Migadu-Queue-Id: 1EB6E1C95 X-TUID: tGFZiuvqXe6p Paul Eggert writes: > What's the use case for these proposed predicates? I'm finding it hard > to review the patch without knowing what it's for. Well, one reason is just general completeness: it's always useful, for any type, to be able to check that a value is of that type before passing it to functions that expect that type, e.g. decoded-time-add. More concretely, in the new implementation of iCalendar/RFC5545 I have been working on (see Bug#74994), I decided to represent iCalendar times and date-times as decoded times (with the idea that decoded-times are the "native" Emacs way to represent these values). This in turn means I need a way to verify that values are of this type before e.g. doing calendar arithmetic with them, or serializing a decoded-time value back out to a string. There are also many places where the iCalendar standard allows both dates and date-times as values, and I need to dispatch based on the type at runtime: e.g. to get the month, I need to use `calendar-extract-month' with a plain date value, but `decoded-time-month' with a date-time value. I need type predicates to do such dispatching. > Surely this should be in time-date.el rather than simple.el. OK, makes sense -- I'll move it there. > The implementation of decoded-time-p seems complicated and doesn't match > what decode-time produces. What seems complicated about it? (Just the use of cl-typep? That can easily be removed.) What are the mismatches with what decode-time produces? > Wouldn't it be simpler to call > (ignore-errors (equal val (decode-time (encode-time val))))? I could certainly change it to that if it's preferable, though that doesn't strike me personally as simpler: it's fewer lines of code, but rests on implicit assumptions about the implementation details of decode-time and encode-time. To me it seems simpler to explicitly encode the constraints that decoded times are supposed to obey. In any case, maybe the problem here is actually my original choice to represent iCalendar date-times as decoded times. If decoded times aren't right for that purpose, I could instead define a new type; but that would mean I won't be able to re-use all the functions that already work with decoded-times, unless I can adapt them to work with the new type, and might end up writing a lot of boilerplate or duplicated code. Hope that helps clarify things!