Let's ignore the "Seattle.rb style" for the moment because I don't know of such a
thing - may well be seattle-duck style. :P
But anyway, I agree with you in at the least one point, which is the warning message:
Anyone who tries to load my 'read_source' gem will get a failure message
in require without explaining the specific area of code.
Perhaps the error message could be more indicative of the error or what the exact
problem is or how to solve it. I understand that the () provide additional information
that is in some way useful to the parser, or whatever is responsible, so perhaps the
message above could be changed somewhat.
I guess ruby core prefers short messages when possible (aka "syntax error, unexpected '}'")
but this is indeed not always extremely helpful. With more recent changes such as the
did-you-mean-gem, but also some other discussions about better and more fine-tuned
control over warnings/error messages, that may be more helpful to the average ruby
hacker.
To the issue about differential parsing, that is actually indeed strange.
Even more surprising is that I actually thought that:
define_method(:some_method_name) { "asdf" }
Is the only way to use define_method() :D
I think I used that always ...
It reminds me a bit of:
get '/' do
play_intro_music
end
versus
get '/' { play_intro_music }
# which does not work
versus
get('/') { play_intro_music }
which works. I always thought that in some cases the ruby parse
needs the (). I'd love to be able to make them optional in the
second case. Oddly enough, for method DEFINITIONS, I always use
() when there are arguments, so "def foo(bar)" is what I prefer
over "def foo bar". This is more an aside though, it is strange
that this changed.
By the way your last example does not work as-is :D
define_method :johny, instance_method(:apple)
NoMethodError: undefined method `instance_method' for main:Object
Sorry for nitpicking there, I understand what you mean.
I guess it may be because of {} having different meanings in ruby
but then again, there was probably some reason unless it was an
accident. It's ~3:15 in Tokyo so I guess in a few hours perhaps
some from the ruby core team can chime in. I did not even know
that we could omit the () there, that was awesome if that was
possible. I remember in my code though, that whenever I used
define_method(), I always used () ... usually in combination with
some eval method thing.