3 ms·
> It's a bit of a weird take when attribute definition in Ruby also uses at signs specifically. No that’s instance variables. > Which part do you find ugly?
by chrisseaton 4y ago
> It's a bit of a weird take when attribute definition in Ruby also uses at signs specifically.
No that’s instance variables.
> Which part do you find ugly?
In Ruby to modify a method you just call a method. I guess I think a second, redundant, way to call methods is not elegant.
- rat87 4y agoIn Ruby if else is not a method for some reason also blocks are not objects for some reason "seems inelegant"
- chrisseaton 4y ago> In Ruby if else is not a method for some reason This is because there’s not a good way to pass two delayed computations - two blocks. Looping constructs were replaced by method variants. > also blocks are not objects for some reason Yeah they’re reifiable but not sure why not reified by default.
- rat87 4y agoBut passing two blocks/lambdas/etc doesn't inherently need to be that difficult it's not in other languages. I don't know that much about Ruby's implementation but I think both the if else and blocks not being objects are that way to prevent Ruby from being even slower. My understanding is if you turn a block into a proc it gets a lot slower.
- remram 4y agoInstance variables != attributes? If that's the case what do you call "attribute"?
- chrisseaton 4y agoAttributes are an interface - a getter and setter method with predictable names. They can be implemented with instance variables as the underlying storage, but they don't have to be.