I may not understand it well, but I don’t like it. The two methods are
so similar that the only way to figure out the difference is to find
cases that will make it hard or impossible to use one of them. It
should be easy to choose which method to use, not hard to figure out
which one not to use.
OK, here you go:
Use send when you want to invoke a method, but you have a variable
holding the name of a method.
Use instance_eval when you want to muck about with the internals of an
object.
Is it the Ruby language that make programmers be good, or is it that
good people are drawn too the Ruby language?
Yes to one, maybe to the other, results not sorted.
In all seriousness, computer languages have historically tended to
reflect
the intentions of their creators, and creating easy-to-use languages has
rarely been on anyone’s radar screen, compared to issues of job
security,
making oneself look brilliant, and locking out the unwashed masses.
Doctors until recently excluded the masses by speaking Latin, geeks
exclude
the masses by speaking a kind of technical shorthand, one in which there
is
an obscure computer term or instruction for every imaginable real-world
contingency (techy-wife to techy-husband at bedtime: “So, are we online
tonight or what?”). It’s sort of like being a teenager your entire life.
There just aren’t many languages that approach Ruby for readability, for
a
reasonable correspondence between how people think and what can be
executed
by the interpreter:
read(file) unless(busy_sleeping)
And there are only a certain number of programmers constitutionally
disposed
to allow their code be this readable and transparent. At its most basic,
it
is the difference between:
“I can solve your problem.”
– and –
“You can solve your problem.”
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.