Here's a line of Ruby from the Rails library:
result = execute schema_creation.accept td
'td' is a variable in local scope
'schema_creation' is a function on the current object, '.accept' is a function on that object, we're passing 'td' to '.accept'
'execute' is a function on the current object, we're passing the result of 'schema_creation.accept td' to 'execute'
I would prefer to write that, for clarity:
execute(schema_creation().accept(td))
Python would insist on the explicit current-object reference:
self.execute(self.schema_creation().accept(td))
But I'm fine with implicit-this of C++ or Java style.
In the Ruby as written (found in Rails/ActiveRecord source) I look at that line of code and think, "What are these words?" There are no hints! I need a Ruby IDE that has evaluated my codebase and looks at the context in any code block to tell me what the things in it are. This is even worse than large Python codebases I'm used to where I have to dig through several files of call chain to figure out what type a parameter being passed in is. Here I don't even know which words are methods or functions or data.
Monday, February 1, 2016
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment