3 ms·
What you're talking about is essentially a syntax specifically for getters, I think (I don't know Ruby that well). I guess my general point about "too much magi
by aston 18y ago
What you're talking about is essentially a syntax specifically for getters, I think (I don't know Ruby that well). I guess my general point about "too much magic" goes away when the magic is part of the language, just on semantics. That is, you don't know the language if you don't know what magic its syntax does.
- sofal 18y agoI don't believe that a typical Java IDE provides a clean enough abstraction to make code generation a big benefit. When it comes down to it, you're still looking at a window full of all the code that the IDE spit out for you. Think of code generation via a compiler versus code generation via an IDE. The code that you see in the window of your IDE should be solely for human eyes. If a lot of it can be trivially automated, then it doesn't deserve space in that window.
- stcredzero 18y agoI'm not 100% sure, but attr_reader looks like it's actually a message send. If it's not, then it could be implemented that way.
- LogicHoleFlaw 18y agoYes, it is a plain old method being executed in the context of the current class. It creates new class methods which can be used to read, but not write, instance variables. There are methods to create read-write and (I think? write-only) properties as well.