• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is it possible to set up an 'instant' idle handler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is it possible to set up an 'instant' idle handler


  • Subject: Re: Is it possible to set up an 'instant' idle handler
  • From: "Arthur J. Knapp" <email@hidden>
  • Date: Thu, 10 Oct 2002 16:08:35 -0400

> Date: Thu, 10 Oct 2002 19:44:26 +0100
> From: has <email@hidden>
> Subject: Re: Is it possible to set up an 'instant' idle handler

> Emmanuel wrote:

>>> on IsTrue( v )
>>> return ( {v} is not in {false,0,"",missing value} )
>>> end

>> I wonder what IsTrue("false") should return :-)


> Total deadlock between AS's implicit coercion logic and long-established
> standard language conventions? A vicious blood-and-guts fight to the death,
> like throwing a kennel-full of attack dogs into the shark tank? Complete
> spacetime collapse, The End of Everything?

Don't make me sic Shane on you again... ;-)


> Don't say you weren't warned. ;)

Get him, Shane!!!


> p.s. For relevance, here's one our Arthur maybe missed: {}

Interesting that you should bring this up. In JavaScript, an empty
array is still a full fledged object and is therefore not "false":

var a = new Array();

if ( a ) //--> true


Typically, I think in terms of allowing a scripter to pass any number
of "false" type of values to my AppleScript handlers as a way of making
up for the fact that AS doesn't allow optional handlers:

on DoSomething( a, b, c )

if not IsTrue( a ) then set a to "default value for a"
if not IsTrue( b ) then set a to "default value for b"
if not IsTrue( c ) then set a to "default value for c"
...

end

DoSomething( 3.14159, "Hello", "World" )
DoSomething( 3.14159, "Hello", 0 )
DoSomething( 3.14159, 0, "World" )
DoSomething( 3.14159, false, false )
etc...

In a situation like this, I would think it very unlikely that a scripter
would want to call the handler like this:

DoSomething( 3.14159, {}, {} )

though in France, they may want to do this:

DoSomething( 3.14159, "false", "false" )

;-)


{ Arthur J. Knapp, of <http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Follow-up: Now Contact 4.2.x to Address Book 3.0.x utility
  • Next by Date: Re: XML beginner question (about special characters display)
  • Previous by thread: Re: Is it possible to set up an 'instant' idle handler
  • Next by thread: Mac OS X, Classic, Quark XPress and Script Debugger
  • Index(es):
    • Date
    • Thread