Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113561 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48041 invoked from network); 16 Mar 2021 13:03:59 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Mar 2021 13:03:59 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CFCFF1804E4 for ; Tue, 16 Mar 2021 05:57:44 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=1.0 required=5.0 tests=BAYES_50,DKIM_INVALID, DKIM_SIGNED,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail.hades.9dev.de (mail.hades.9dev.de [88.99.187.36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 16 Mar 2021 05:57:43 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 42AD05DDD1; Tue, 16 Mar 2021 13:57:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9dev.de; s=dkim; t=1615899462; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Xunm6RwPjhePh+4CnKU8uzPtA9L8OEVhUbV0ElTyhrE=; b=B9lX9hdHWn36bYUrtDRUp1A/KyjpIW3YB0D3LLS9DKvj7ElsjTkASrM7FhOpguM5kmAZNT RX8y8IbvILsKamNK025otcRclNeZiMpUgfHyisyDUaDf/HmDHXLqG4ykV+V+MCHMWzjj52 sA9/L33jouJHK7uJZlmmKKeP+Q67SMEENFL/4biEOBzCvONA8vBYGc4Qkevi4CODymr28b dqwy+gkMnBbXaKhZEq0p4abl+Fz6ZGAVAZUPzzjRxMPMDLy4E0W+8OGOwqj7b1fvI6qrB1 3sdpTsOrUJ3K6DjFhe11nVsJuXFYK+Wia62e3ebLf+QKNWphqCkbGOvlm6Hc7g== Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) In-Reply-To: Date: Tue, 16 Mar 2021 13:57:40 +0100 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Derick Rethans X-Last-TLS-Session-Version: TLSv1.2 Subject: Re: [PHP-DEV] Add __toString() to DateInterval From: m@9dev.de (Moritz Friedrich) > I also don't understand what you're trying to say. You can't round = trip=20 > every interval as encoded in a DateInterval object through an ISO=20 > interval string, so we shouldn't attempt to do that. I think you do know what I=E2=80=99m trying to say, but choose to = disagree with me. ISO interval strings allow to express arbitrary = intervals of time as a string, so I don=E2=80=99t know what possible = intervals you=E2=80=99re referring to that purportedly cannot be encoded = as an interval string. If this still revolves around relative intervals, then I don=E2=80=99t = see your point either. The ISO interval specification is the most = appropriate serialization format for time intervals as it is commonly = used and well understood. By choosing to serialize something like = =E2=80=9Enext week=E2=80=9C to an ISO interval, I=E2=80=99m willingly = accepting the conversion to an absolute amount of time. If the specific = start and end dates are relevant for the use case, an interval is not = the appropriate tool, but keeping both dates is. Having a constructor that only accepts an ISO interval but no way to = serialize the duration object back to an interval seems just like an = inconsistent API to me. I=E2=80=99m not particularly attached to using = `__toString()`, something like `toIsoInterval` or similar would do just = as well. The only thing that annoys me here is a one-way parser for = interval specs, deferring the serialization to userland PHP.=20 Regards, Moritz=