Hacker News new | past | comments | ask | show | jobs | submit login

obsurveyor, I'm the lead developer. I've been doing ruby forever. The .cur is going to go away, along with .or and .and I'm in the middle of a big refactor of the reactive stuff to simplify all of that.



Then why the _'s everywhere, ruby is snake case but I don't think I've ever seen anyone do :_foo => "bar" or _foo: "bar"


So the models in volt basically let you read and assign attributes with an _ We could use the model[:key] instead, but the nice thing with using _ is that you can then define your own getters and setters easily in the model class. The _ is sort of a quick prototyping tool, allowing you to start using attributes without defining them in the model. We're going to add it where you can say something like:

model_attr :field_name, String

then do:

model.field_name = 'something'

(without the _)

The _ keeps people from calling a method that isn't defined, since ._something will return nil if its not defined yet. But if you called .something, it will still raise an exception.

Does all of that make since?


That sounds ripe for misuse and kind of schizophrenic with the different behavior based on the name of the attribute. You should pick one behavior(throw an exception) and apply it everywhere. If you want quick prototyping features, then make that something you include with a gem or something, don't let it infect the framework.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: