daz wrote:
> Yukihiro Matsumoto wrote:
>
>>David A. Black writes:
>>
>>|Here's another idea:
>>|
>>|Kernel#send
>>|Kernel#send! # dangerous version, includes private methods
>>
>>It's bit different from my sense of dangerousness, but let me
>>consider.
>>
>>matz.
>>
>
>
> [replying to David]
>
> It's easy to understand the meaning of #send! when reading
> this thread because it is within context but, as Matz implies,
> bang! methods usually provide the destructive counterpart
> of a non-bang method (i.e. an object is modified in place
> rather than being copied first).
> -- Yes, I know you know that :-)
>
> There's nothing inherently dangerous about bang methods;
> we use them quite safely.
>
> Calling private methods could be dangerous but overloading
> the meaning of the "!" suffix needs careful consideration
> and I understand Matz' concern.
>
> Having said that, my initial reaction to #send! was positive
> and, for insiders like yourself and for me too, it should be
> easy to remember -- for teaching and learning, though, it
> may create an obstacle.
>
> With 5 votes in support, I felt there was room for some balance.
> Any of the +1 voters strong enough to change their mind ?
>
Well, I'll start with another "I know you know this, but ..."
observation: This is not a democracy. It's more a case of "Make a
convincing case to Matz."
My first reaction to 'fcall' was that it appears to be a counterpart to
send, but has no obvious semantic connection. I like 'send!' because it
conveys the idea that you are about to do something that is similar to
another action, but may have unexpected or risky side-effects, and it
makes it easier to explain the two.
On the other hand, send!/fcall is not actually sending a message; it
bypasses the receiver's encapsulation perimeter and digs straight into
the object. It is a forcible invocation of a method, not a request to
handle a message (which may or may not map to a method or a suitable
processing path).
So perhaps 'send!' is misleading. Maybe 'demand!' or 'invoke!' or
'do_this_dammit!' is better.
James
--
http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys