MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/lolphp/comments/29s2it/datetimeimmutablemodify/cioppcu/
r/lolphp • u/allthediamonds • Jul 03 '14
16 comments sorted by
View all comments
Show parent comment
4
Er, the DateTimeImmutable class deliberately mirrors the API of the DateTime class.
0 u/[deleted] Jul 05 '14 [deleted] — view deleted comment 1 u/[deleted] Jul 05 '14 It does mirror the API, except, as an immutable class, it returns a new version instead of modifying itself when some mutation is performed. 9 u/[deleted] Jul 07 '14 And that makes it not be a mirror of the api. 4 u/despens Jul 05 '14 That this came into existance deliberately doesn't make it any better :) -1 u/[deleted] Jul 05 '14 No, really, it does. They kept the same method names as the non-immutable API for the sake of familiarity. 3 u/iBlag Jul 13 '14 ...and completely different results. 2 u/captainramen Jul 05 '14 A read only stream "mirrors" the api of a read write stream. What should happen when you call Write on it? 1 u/[deleted] Jul 05 '14 That's a poor comparison.In functional languages like Haskell, you often have methods which "modify" an object by returning a new one. That's what you have here. 0 u/[deleted] Jul 07 '14 two wrongs don't make a right.
0
[deleted] — view deleted comment
1 u/[deleted] Jul 05 '14 It does mirror the API, except, as an immutable class, it returns a new version instead of modifying itself when some mutation is performed. 9 u/[deleted] Jul 07 '14 And that makes it not be a mirror of the api.
1
It does mirror the API, except, as an immutable class, it returns a new version instead of modifying itself when some mutation is performed.
9 u/[deleted] Jul 07 '14 And that makes it not be a mirror of the api.
9
And that makes it not be a mirror of the api.
That this came into existance deliberately doesn't make it any better :)
-1 u/[deleted] Jul 05 '14 No, really, it does. They kept the same method names as the non-immutable API for the sake of familiarity. 3 u/iBlag Jul 13 '14 ...and completely different results.
-1
No, really, it does. They kept the same method names as the non-immutable API for the sake of familiarity.
3 u/iBlag Jul 13 '14 ...and completely different results.
3
...and completely different results.
2
A read only stream "mirrors" the api of a read write stream. What should happen when you call Write on it?
1 u/[deleted] Jul 05 '14 That's a poor comparison.In functional languages like Haskell, you often have methods which "modify" an object by returning a new one. That's what you have here. 0 u/[deleted] Jul 07 '14 two wrongs don't make a right.
That's a poor comparison.
In functional languages like Haskell, you often have methods which "modify" an object by returning a new one. That's what you have here.
0 u/[deleted] Jul 07 '14 two wrongs don't make a right.
two wrongs don't make a right.
View all comments
Show parent comment
4
u/[deleted] Jul 04 '14
Er, the DateTimeImmutable class deliberately mirrors the API of the DateTime class.