Mouse polling

Scott Raney raney at metacard.com
Sun Mar 3 13:28:07 CST 2002


On Sun, 3 Mar 2002 =?ISO-8859-1?Q?Bj=F6rnke_von_Gierke?= <bvg at mac.com> wrote:

(I added a CC to improve-resolution because part of the problem here
is that parts of the discussion has appeared on several different
mailing lists)

> After reading the whole discussion on the "mouse" function twice, i 
> still don't see exactly where the trouble comes from. Thus I wrote this 
> long winded mail. Maybe im just too stupid (or my english isn't good 
> enough) to understand where people have problems, but here is what I 
> think the mouse SHOULD do:
> 
> script:
> if the mouse is down
> 
> result:
> true when the mousebutton is down when the script comes to the execution 
> of the above line.

This is not the way HyperCard works, and there are significant, if
esoteric, reasons why the HC way is right.  Please reread the previous
discusions to maybe understand why.

> this automatically leads to the following:
> 
> script:
> repeat until the mouse is down
> beep
> end repeat

Exactly, and this is exactly why the mouse function is so heinous ;-)

(snip)

> I just don't understand how this can lead to any problem at all? A 
> different mater is the following example:
> 
> script:
> repeat while the mouse is down
> set the loc of field "grabMe" to the mouseLoc
> end repeat

This is really the core of the problem: this loop uses 100% of the CPU
time, regardless of the speed of the processor, bringing the system to
its knees, causing poor feedback for your app, and making your system
unresponsive to any other processes running on it.  You see, on a fast
system, 99.99% of the time through that loop you're setting the loc to
exactly the same coordinate!

I think the biggest problem here is that OSs have evolved way beyond
the point where even developers (or at least most of our customers)
understand how they work.  There's nothing wrong at all with things
like "the mouse" on single-user single-tasking OSs like MacOS, but
that's just not the world we live in anymore.  I hate to be in the
position to restrict access to important functionality to protect
people from themselves, but as I said, it's become abundantly clear
(except maybe to Curry ;-) that it's for good of the language, our
customers, and users of products that our customers develop, to make
doing things the wrong way harder.

Believe me, I'm certainly sympathetic to the "easier way" and
"programming for the rest of us" arguments, but none of us can afford
to be classed as developers of system-hostile applications just
because we happen to use a language that other people who don't know
any better use to develop system-hostile applications.  Developing in
a high level language will become a stigma that we'll never live down
if we don't nip this in the bud.
  Regards,
    Scott

> thank you
> Björnke von Gierke

********************************************************
Scott Raney  raney at metacard.com  http://www.metacard.com
MetaCard: You know, there's an easier way to do that...





More information about the use-livecode mailing list