Re: [PHP-DEV] DateTime improvement

2012-12-26 Thread Derick Rethans
Stas Malyshev wrote: > > Sebastian had responded off-list that he'd rather have DateTime > inherit > > from DateTimeImmutable, instead of the current variant where > > DateTimeImmutable inherits DateTime. While this OO-design principle > wise > > makes perfect sense, practically it is not as h

Re: [PHP-DEV] DateTime improvement

2012-12-25 Thread Stas Malyshev
Hi! > Sebastian had responded off-list that he'd rather have DateTime inherit > from DateTimeImmutable, instead of the current variant where > DateTimeImmutable inherits DateTime. While this OO-design principle wise > makes perfect sense, practically it is not as handy. I've played with a Act

Re: [PHP-DEV] DateTime improvement

2012-12-24 Thread Derick Rethans
On Tue, 18 Dec 2012, Adam Harvey wrote: > On 18 December 2012 04:52, Lars Strojny wrote: > > I would go with DateTimeValue or DateTimeImmutable as well. > > +1. I'd prefer DateTimeImmutable personally because it describes what > it is better than the other options. That's what I have changed it

Re: [PHP-DEV] DateTime improvement

2012-12-21 Thread Nikita Nefedov
bject: Re: [PHP-DEV] DateTime improvement On 20 December 2012 20:06, Lazare Inepologlou wrote: Of course, I have no idea if anyone in userspace is using DateTimeImmutable... Well, it seems unlikely, unless he is Yoda or French. I mean, in English, it is common to put the adjective in front o

Re: [PHP-DEV] DateTime improvement

2012-12-21 Thread Derick Rethans
On Thu, 20 Dec 2012, Larry Garfield wrote: > I've seen DateTimeValue used elsewhere for userspace immutable date > time objects. Whether that indicates we SHOULD or SHOULD NOT use that > for an in-C version, I don't know. (I'm inclined to say > should-but-namespace, but I don't know if we're

RE: [PHP-DEV] DateTime improvement

2012-12-21 Thread Christian Stoller
namespace, too. Are there any plans to do that? Christian Stoller -Original Message- From: Peter Cowburn [mailto:petercowb...@gmail.com] Sent: Friday, December 21, 2012 1:14 AM To: Lazare Inepologlou Cc: Larry Garfield; internals@lists.php.net Subject: Re: [PHP-DEV] DateTime improvement On

Re: [PHP-DEV] DateTime improvement

2012-12-20 Thread Peter Cowburn
On 20 December 2012 20:06, Lazare Inepologlou wrote: >> Of course, I have no idea if anyone in userspace is using > DateTimeImmutable... > > Well, it seems unlikely, unless he is Yoda or French. > > I mean, in English, it is common to put the adjective in front of the noun, > isn't it? Class name

Re: [PHP-DEV] DateTime improvement

2012-12-20 Thread Lazare Inepologlou
> Of course, I have no idea if anyone in userspace is using DateTimeImmutable... Well, it seems unlikely, unless he is Yoda or French. I mean, in English, it is common to put the adjective in front of the noun, isn't it? Lazare INEPOLOGLOU Ingénieur Logiciel 2012/12/20 Larry Garfield > I've

Re: [PHP-DEV] DateTime improvement

2012-12-20 Thread Larry Garfield
I've seen DateTimeValue used elsewhere for userspace immutable date time objects. Whether that indicates we SHOULD or SHOULD NOT use that for an in-C version, I don't know. (I'm inclined to say should-but-namespace, but I don't know if we're doing that yet.) Of course, I have no idea if anyo

Re: [PHP-DEV] DateTime improvement

2012-12-17 Thread Adam Harvey
On 18 December 2012 04:52, Lars Strojny wrote: > I would go with DateTimeValue or DateTimeImmutable as well. +1. I'd prefer DateTimeImmutable personally because it describes what it is better than the other options. Adam "bikeshed" Harvey -- PHP Internals - PHP Runtime Development Mailing List

Re: [PHP-DEV] DateTime improvement

2012-12-17 Thread Lars Strojny
Hi Derick, I would go with DateTimeValue or DateTimeImmutable as well. Am 17.12.2012 um 19:42 schrieb Benjamin Eberlei : > On Mon, Dec 17, 2012 at 5:48 PM, Derick Rethans wrote: > I went for DateTimePoint. Point as in "Point in time". I am not too > happy with the name, but I think it works bet

Re: [PHP-DEV] DateTime improvement

2012-12-17 Thread Benjamin Eberlei
On Mon, Dec 17, 2012 at 5:48 PM, Derick Rethans wrote: > > I went for DateTimePoint. Point as in "Point in time". I am not too > happy with the name, but I think it works better than DateTimeImmutable > as that just sounds quircky. I'm still fixing up a few things and adding > some test cases. I t

Re: [PHP-DEV] DateTime improvement

2012-12-17 Thread Derick Rethans
On Sun, 16 Dec 2012, Lars Strojny wrote: > Am 16.12.2012 um 13:21 schrieb Derick Rethans : > > > On Tue, 11 Dec 2012, Derick Rethans wrote: > > > >> On Mon, 10 Dec 2012, Herman Radtke wrote: > >> > >>> Another option is to make an ImmutableDateTime class. The DateTime > >>> class could actuall

Re: [PHP-DEV] DateTime improvement

2012-12-16 Thread Derick Rethans
On Sun, 16 Dec 2012, Stas Malyshev wrote: > > Al the methods will *still* return the modified DateTime object - > > it's just that the one that you *call* f.e. ->modify() on won't > > change anymore. > > Doesn't it mean you can just call clone() on it in modifier methods > before doing anythin

Re: [PHP-DEV] DateTime improvement

2012-12-16 Thread Stas Malyshev
Hi! > Al the methods will *still* return the modified DateTime object - it's > just that the one that you *call* f.e. ->modify() on won't change > anymore. Doesn't it mean you can just call clone() on it in modifier methods before doing anything else? -- Stanislav Malyshev, Software Architect

Re: [PHP-DEV] DateTime improvement

2012-12-16 Thread Derick Rethans
On Sun, 16 Dec 2012, Lester Caine wrote: > > > I'm not really against that, but we do need to use the Date namespace - > > > >>so DateTimeImmutable. It might be trickier to do than it sounds > > > >>though... > > > > > > I've started hacking on this - with some luck I'm done before PHP 5.5 > > >

Re: [PHP-DEV] DateTime improvement

2012-12-16 Thread Никита
I have actually started too, but I made it w/o inheritance from DateTime, and I made many of inline functions to avoid code repetition, so I don't know how good is it. The code on my work computer, so I can show it tomorrow. Derick Rethans писал(а) в своём письме Sun, 16 Dec 2012 16:21:4

Re: [PHP-DEV] DateTime improvement

2012-12-16 Thread Lester Caine
I'm not really against that, but we do need to use the Date namespace - >>so DateTimeImmutable. It might be trickier to do than it sounds >>though... I've started hacking on this - with some luck I'm done before PHP 5.5 beta1. Am I missing something here? Isn't this just making the object conte

Re: [PHP-DEV] DateTime improvement

2012-12-16 Thread Lars Strojny
This is so cool, thanks Derick! If you need help with testing or anything else, let me know. Am 16.12.2012 um 13:21 schrieb Derick Rethans : > On Tue, 11 Dec 2012, Derick Rethans wrote: > >> On Mon, 10 Dec 2012, Herman Radtke wrote: >> >>> Another option is to make an ImmutableDateTime class.

Re: [PHP-DEV] DateTime improvement

2012-12-16 Thread Derick Rethans
On Tue, 11 Dec 2012, Derick Rethans wrote: > On Mon, 10 Dec 2012, Herman Radtke wrote: > > > Another option is to make an ImmutableDateTime class. The DateTime > > class could actually be changed to inherit the ImmutableDateTime > > class. The only extensions on the DateTime class would be the mu

Re: [PHP-DEV] DateTime improvement

2012-12-11 Thread Никита
Stas Malyshev писал(а) в своём письме Tue, 11 Dec 2012 21:06:05 +0400: Hi! As Nikita says, from an ORM perspective, an object is always immutable (at least with current implementations I know of), and that's because they can simply use the object hashes to identify two different objects.

Re: [PHP-DEV] DateTime improvement

2012-12-11 Thread Stas Malyshev
Hi! > @Stas a DateTime object is the perfect representation of what in DB > world has dozens of different representations. The reasoning behind it > is exactly the same as having a DateTime object vs having a date+time > string. You are confusing internal PHP representation with object identity v

Re: [PHP-DEV] DateTime improvement

2012-12-11 Thread Stas Malyshev
Hi! > strings/timestamps (it could be database's representation of date like > "2010-10-23" or just integer with timestamp) or it could be objects of > DateTime. More efficient and logical way would be objects, but that way > you must aware users that they shouldn't modify values of DateTime

Re: [PHP-DEV] DateTime improvement

2012-12-11 Thread Daniel Ribeiro Gomes
People tend to desire API changes that go on the same directions they are going. That's nature... Daniel Ribeiro Gomes Pereira Twitter | Facebook | LinkedIn

Re: [PHP-DEV] DateTime improvement

2012-12-11 Thread Stas Malyshev
Hi! > As Nikita says, from an ORM perspective, an object is always immutable > (at least with current implementations I know of), and that's because > they can simply use the object hashes to identify two different objects. Why for ORM Date is even an object? In most databases, date is a basic va

Re: [PHP-DEV] DateTime improvement

2012-12-11 Thread Marco Pivetta
As Nikita says, from an ORM perspective, an object is always immutable (at least with current implementations I know of), and that's because they can simply use the object hashes to identify two different objects. While this may be a niche to many of you, I've encountered a quite big amount of peo

Re: [PHP-DEV] DateTime improvement

2012-12-11 Thread Nikita Nefedov
Hi! Date is immutable, but there's no reason why date object should be able to represent only one date. Reference to Java is not exactly applicable here, as many problems existing in Java (thread safety, long-living object references, etc.) do not exist in PHP. Say we have a blog post entity,

Re: [PHP-DEV] DateTime improvement

2012-12-10 Thread Derick Rethans
On Mon, 10 Dec 2012, Herman Radtke wrote: > On Mon, Dec 10, 2012 at 11:39 AM, Ángel González wrote: > > On 10/12/12 16:18, Nikita Nefedov wrote: > >> So there had been at least two or three messages (subjects) about > >> DateTime object and everytime there was this problem - people tend to > >> t

Re: [PHP-DEV] DateTime improvement

2012-12-10 Thread Stas Malyshev
Hi! > As long as we know, it's not so good - date is immutable by nature. I > don't want to write here why it's so, I will just throw this link: > http://www.ibm.com/developerworks/java/library/j-jtp02183/index.html Date is immutable, but there's no reason why date object should be able to re

Re: [PHP-DEV] DateTime improvement

2012-12-10 Thread David Muir
On 11/12/12 06:59, Herman Radtke wrote: On Mon, Dec 10, 2012 at 11:39 AM, Ángel González wrote: On 10/12/12 16:18, Nikita Nefedov wrote: So there had been at least two or three messages (subjects) about DateTime object and everytime there was this problem - people tend to take DateTime object

Re: [PHP-DEV] DateTime improvement

2012-12-10 Thread Herman Radtke
On Mon, Dec 10, 2012 at 11:39 AM, Ángel González wrote: > On 10/12/12 16:18, Nikita Nefedov wrote: >> So there had been at least two or three messages (subjects) about >> DateTime object and everytime there was this problem - people tend to >> take DateTime object as mutable object and it really i

Re: [PHP-DEV] DateTime improvement

2012-12-10 Thread Ángel González
On 10/12/12 16:18, Nikita Nefedov wrote: > So there had been at least two or three messages (subjects) about > DateTime object and everytime there was this problem - people tend to > take DateTime object as mutable object and it really is. > As long as we know, it's not so good - date is immutable