Ya, I really don't like the name either, as it (deeply) exposes the
implementation, IMHO. That said, here's my hypocritical votes:

* spawn_eval
* forked_eval
* eval_newthread
* newthread_eval
* run_on_new_thread

That said, why not just lie to us (as object models are wont to do) and have
the API match my intent:

ie.alert.dismiss_when_shown(:value, "OK") 
ie.button(:name,"btnfoo").click

Scott

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord
Sent: Tuesday, August 09, 2005 6:58 PM
To: [email protected]
Subject: Re: RE: [Wtr-general] New, improved support for popup dialogs

There is a method in Ruby which is called 'eval'. It takes a string and 
evaluates it as Ruby code.

IE#remote_eval is based on this, hence the name. Python and Perl and Lisp 
all have eval methods that do the same thing, so the name is pretty well 
established and understood by anyone who has used any of these languages. 
Eval is short for evaluate, which is the name for what you do when you run 
code in an interpreted language. The equivalent with a compiled language 
would be "compile, link and execute."

This varient of eval does two things in addition:
1. It evaluates in a separate process spawned by a separate thread.
2. It evaluates in the context of an IE object that is the equivalent to 
the one that invoked the method. It actually uses Ruby's instance_eval to 
do this.

People who want to learn more about what this method does would do well to 
learn more about eval and instance_eval, so it might be good to base the 
name on these methods.

Here are some other possible names:

         remote_instance_eval
         sub_process_eval
         process_eval
         parallel_instance_eval

In a way, Watir shouldn't force users to even have to understand this 
concept (and i have ideas for how to eventually get there), but since it 
does now, i'm reluctant to sugar coat it too much.

At 06:32 PM 8/9/2005, Paul Rogers wrote:
>Bret,
>Im assuming you've named remote_eval that based on what it is doing. I 
>dont find it a very intuitive name. Maybe something like one of these:
>
>ie.execute_command( )
>ie.run_command()

I'm not sure what a 'command' is in Ruby. It's a not part of the Watir or 
Ruby lexicon.

IE#remote_eval can actually take any ruby code as its argument (in string 
form), including multiple method calls separated by semicolons or 
conditional logic or what have you. (You can embed 'puts' statements in the 
string to debug errors.)

>ie.delayed_execution()  # is it actually delayed??

No. Actually the argument code and the subsequent code are running in 
parallel and either might actually be the next to be executed. Neither is 
delayed.

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to