Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66824 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37558 invoked from network); 27 Mar 2013 08:03:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Mar 2013 08:03:03 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.179 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.223.179 mail-ie0-f179.google.com Received: from [209.85.223.179] ([209.85.223.179:37266] helo=mail-ie0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7D/F0-30100-6B7A2515 for ; Wed, 27 Mar 2013 03:03:03 -0500 Received: by mail-ie0-f179.google.com with SMTP id k11so9924162iea.10 for ; Wed, 27 Mar 2013 01:03:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=wbfi+Kb8X1FdxME6ee4ePRnnkxAQ4Snlcq2YaLv2F1g=; b=bPTtdI6IQLMLH7DI5l3qAjMPZvEeDBRNO/RNZNq+be3tiHToygBcZ8LdopqdnTiQf1 yutK4nf9TK7CstBcw3AEvhQnsYz78uNEDIh8l5BWP3BBM4SnWIjisXxdi5HWzyg87P0B T901bprNjQ8GpjWLSJEV8HNx/wuItHxQYft1IQvL4d2UZsvuqVmEFG5T71BD+QXn6vrI Zzf0hv+xHn9NQRdKw3AcwUJCvFdcmTvQwhW05YXdKnS4P/z5UdSo4hDa0QNV7JJUzf8h kwlCKar1oPTch4GyOWScvRwpd/JkFWPgZn5gf8R2JlHXJ7MDio+hMMUNJ72h4usrUTZ9 X4og== MIME-Version: 1.0 X-Received: by 10.50.186.227 with SMTP id fn3mr3674133igc.17.1364371380663; Wed, 27 Mar 2013 01:03:00 -0700 (PDT) Received: by 10.50.66.207 with HTTP; Wed, 27 Mar 2013 01:03:00 -0700 (PDT) Received: by 10.50.66.207 with HTTP; Wed, 27 Mar 2013 01:03:00 -0700 (PDT) In-Reply-To: References: Date: Wed, 27 Mar 2013 09:03:00 +0100 Message-ID: To: Michael Wallner Cc: PHP Internals Content-Type: multipart/alternative; boundary=14dae93408a57c7f6e04d8e37743 Subject: Re: [PHP-DEV] DateTimeImmutable From: tyra3l@gmail.com (Ferenc Kovacs) --14dae93408a57c7f6e04d8e37743 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2013.03.26. 20:29, "Michael Wallner" ezt =C3=ADrta: > > Hi all! > > I am concerned by the introduction of DateTimeImmutable extending > DateTime, and despite not being the talking guy, I'll try to outline > the reasons why I and obviously a lot of other people think so. > > I can understand the frustration with a DateTime that should not have > been modifiable in the first place and the wish to improve upon things > and to lead users to the proper way. But, this is not the right way. > > If interoperability was in mind, it will not be given, because every > single API which has been written in the last seven years and has > DateTime in it's signature is potentially broken. The code may and > should be able to expect a modifiable instance of DateTime, which is > no longer guaranteed. > > The argument, that it was implemented this way, so that method > signatures do not have to be changed, is weak, because every method > has to be reviewed, and a method signature change would actually be > the right thing to accept a DateTimeImmutable, because it does not act > like a DateTime. > > It will lead to lots of boilerplate typechecking code with instanceof > because it actually is not the same type. DateTimeImmutable extending > DateTime will instantly create BC issues, which we will suffer from a > long time. > > The toughtful developer, which already cloned the DateTimes in his > methods won't benefit either, because now he's cloning > DateTimeImmutables. > > In my opinion, the only way to "solve" this issue is through > documentation, advocation, publication and providing DateTimeImmutable > as a sibling to DateTime. > > DateTime is here, and we cannot go back in time, but we might > deprecate DateTime* and introduce a date namespace in PHP-next to > clean up this front, but this already goes beyond the issue with > DateTimeImmutable. > > > -- > Regards, > Mike > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > would it make sense to introduce an interface wich both DateTime and DateTimeImmutable implements? that way you can typehint for both if you know that both classes are fine for you. --14dae93408a57c7f6e04d8e37743--