5 ms·
I could be reading the tone of the interview wrong, but it seems like there's a weird sort of anti-intellectualism bent to the Ruby community. In the middle, t
by rrradical 10y ago
I could be reading the tone of the interview wrong, but it seems like there's a weird sort of anti-intellectualism bent to the Ruby community.
In the middle, there's this exchange:
Jonan: So you would just use pointers to point to those immutable objects?
Koichi: Yes. Also, I want to note that immutable doesn't mean frozen object.
Frozen objects can contain mutable objects. So I mean those immutable objects which only contain children
that point to immutable objects.
Jonan: So if we had a nested hash, some large data structure, we would need to
freeze every object in that in order to reference it this way. Is there a facility in Ruby right now to do that?
I think I would have to iterate over that structure freezing objects manually today.
Matz: Not yet.
Jonan: So there might be?
Matz: We need to provide something to freeze these objects.
Aaron: A deep freeze.
Matz: Yes, deep freeze.
Jonan: Deep Freeze is the name of this feature maybe? I think that would be an excellent name for it.
So yes, they all agree that Ruby's current 'frozen' feature doesn't grant real immutability guarantees.
But then at the end...
Jonan: OK. So then, a friend asked me when I described guilds, he writes a lot of Haskell,
he asked me when we are we going to have "real immutable objects", and I don't quite know what he means.
Is there some distinction between an immutable object in Ruby and an
immutable object in a different language that’s important?
Matz: For example in Haskell, everything is immutable, it’s that kind of language, everything is immutable from day one.
Jonan: Yes.
Matz: But in Ruby we have mutable objects, so under that kind of situation we need a whole new construct.
Aaron: Frozen objects should really be immutable. It's really immutable.
Jonan: OK.
Aaron: I don't...
Jonan: You don't know what this person who air-quoted me "real immutable" was saying?
Aaron: Yeah I don't know why they would say "real immutable".
Jonan: Should I unfriend him on Facebook? I think I'm going to after this.
Matz: At least tell him if you want "real immutable" go ahead and use Haskell.
Jonan: I think that's an excellent option, yeah.
Aaron: You just to need to say to them quit "Haskelling" me.
Jonan: I should, I’ll just tell them to quit "Haskelling" me about immutable objects.
I get that they are joking a bit, but do they really not understand that the Haskeller is referring to the lack of deeply immutable objects? The hostility seems a bit weird to me, given that languages like Haskell push forward our understanding of the usefulness of things like immutability, which then get absorbed into other languages (like Ruby, clearly).
- mmahemoff 10y agoI do think this is the culture of Ruby, appealing to some and not to others. Ruby is a practical language by design and it's common to see good-natured poking fun at academic concepts that sound good in theory, but fall apart on corner cases (and real projects are full of corner cases). Case in point: https://twitter.com/dhh/status/216238003817938944 https://twitter.com/dhh/status/216238003817938944 People looking for conceptual purity should look elsewhere.
- tinco 10y agoPlease don't look elsewhere for conceptual purity. Ruby is absolutely ideal for exploring any concept that can be expressed in object oriented programming, and even many that are expressed in algebra. Ruby has been designed fundamentally as an Alan Kay style object oriented programming language. In that light in my opinion it is more suitable for conceptual purity than most other scripting languages. DHH's criticism of SRP has to do with legitimate drawbacks. I think all of us have experienced the over-engineering SRP can invoke when applied naievely. Also note that DHH's framework Rails has made significant steps in enabling SRP for modern Rails applications, so this is not a flat out rejection of the idea.
- mmahemoff 10y agoI'm not sure Ruby is ideal for exploring OO concepts, as fine a language as it is. Missing, for example, are: inheritance of class attributes/methods, constraints on overriding methods (e.g. declaring as abstract or un-overridable/final), dynamic attributes. Thankfully it's a very flexible and forgiving language, so there are third-party libraries (e.g. Hashie, ActiveSupport's Concern) to accomplish these kinds of things, but the core language doesn't offer them.
- jdminhbg 10y agoThe SRP isn't really an academic concept, it's an industry concept: https://en.wikipedia.org/wiki/Single_responsibility_principle https://en.wikipedia.org/wiki/Single_responsibility_principl... I'd say it's more of a question of taste and organization.