Re: WARNING messages in MetaCard 1.4 and global variables

Scott Raney ((no email))
Mon, 21 Nov 94 10:07:21 MST

> With version 1.4 we get lots of unwelcome WARNING messages
> in the console window. Can we switch them off ?

No, you'll have to fix the underlying cause.

> The warnings are due to global variables not being explicitly
> declared global in each script that uses them. Why isn't it
> enough to declare them global once and for all, say in the script
> of the parent stack ?

Because this isn't how HyperCard works. We ran into some HyperCard
stacks where because of a poor choice of global variable names, didn't
work right in MetaCard.

You can just declare the global once per *script* if you put the
global statement at the top of the script, outside all handlers.

> We never had these warnings in 1.3, and the applications worked OK.
> And it is practically impossible to find the reason for some of the
> warnings eg if mc complains about a "literal shadowing a global in
> handler mouseUp. WHICH handler mouseUp - there are dozens.

The message will appear when the handler is parsed, which occurs when
either the card is opened, or a message is sent to the object. If you
only have a few "mouseUp" handlers, you can probably find it most
easily by just looking at the scripts. If you have lots of objects,
or very long scripts, you may want to use a script dumping utility
(such as the one found in the MetaCard /contrib directory).

You can also load the stack into a binary file editor (such as Emacs)
and use the search feature to find the global references. Note that
you can't edit the script in the editor. You'll have to find out the
name of the object (the script starts 7 bytes after the name) and edit
the script in MetaCard.

The time to discover this behavior was about 2 months ago during the
beta process. We only had one request to make the message more
specific and so didn't change it. The take-home message is that if
you don't participate in the beta process, you're giving up your
primary means of ensuring that the product meets your needs.

> Alan Hewat, ILL Grenoble, FRANCE (hewat@ill.fr) Fax (France=33).76.48.39.06

-- 
***********************************************************************
* Scott Raney  303-447-3936            Remember: the better you look, *
* raney@metacard.com                   the more you'll see -- Lidia   *
***********************************************************************