[comp.sys.mac.hypercard] HyperCard Implementation Questions.

shinberd@unioncs.UUCP (David Shinberg) (02/21/89)

Hello,
  I am working on HyperCard for a programming languages course and have run
  into a few questions involving the implementation of HyperCard.  I realize
  that some information may only be known inside apple and not available
  to the public.  Here goes it anyway.
  
  1) Why do certain commands generate errors when invoked from the MessageBox?
     e.g. if, repeat, etc
  2) What method of memory allocation does HyperCard use?
     e.g. Stack, heap, etc                    
  3) How are global variables stored and referenced?

				Thanks Much

				David A. Shinberg
88_shinb@union.BITNET					Box 2073
uunet!steinmetz!unioncs!shinberd			Union College
							Schenectady NY, 12308

dan@Apple.COM (Dan Allen) (02/22/89)

In article <1184@unioncs.UUCP> shinberd@unioncs.UUCP (David Shinberg) writes:
>  1) Why do certain commands generate errors when invoked from the MessageBox?
>     e.g. if, repeat, etc
>  2) What method of memory allocation does HyperCard use?
>     e.g. Stack, heap, etc                    
>  3) How are global variables stored and referenced?

Structured statements like repeat and if are not allowed currently in
the message box.  They must be in a script.

HyperCard uses both the standard Macintosh stack (the stack pointer is
register A7 of the 68000) as does all Macintosh applications.  In
addition, HyperTalk has its own stacks for pushing and poping variables
and scopes and the like.  These stacks are not available to HyperTalk
programmers in any way.

Bitmaps and cards and backgrounds and text is all manipulated with the
standard Macintosh Memory Manager which uses the application heap.  For
more information on this, read Inside Macintosh.

Global variables are stored by HyperTalk in a private manner, i.e., if
we documented it we couldn't change it, which we are planning to do for
various reasons including performance.

Dan Allen
HyperCard Team
Apple Computer

desnoyer@Apple.COM (Peter Desnoyers) (02/22/89)

In article <26170@apple.Apple.COM> dan@Apple.COM (Dan Allen) writes:
>
>Structured statements like repeat and if are not allowed currently in
>the message box.  They must be in a script.
>
Is there any particular reason for this? It would be very convenient
to be able to use these statements from the message box.

				Peter Desnoyers

carterbk@apple.com (Bryan K. Carter) (02/22/89)

In article <26177@apple.Apple.COM> desnoyer@Apple.COM (Peter Desnoyers) 
writes:
> In article <26170@apple.Apple.COM> dan@Apple.COM (Dan Allen) writes:
> >
> >Structured statements like repeat and if are not allowed currently in
> >the message box.  They must be in a script.
> >
> Is there any particular reason for this? It would be very convenient
> to be able to use these statements from the message box.

In order to execute a repeat there needs to be more than just one line of 
code, i.e.:

repeat 3
   do this
   do that
end repeat

As far as 'if' statements being in the message handler, the same concept 
may apply.  There are so many possibilities for an if/then/else/end if 
statement, that one line of code is not going to cut it.  However, 
something like 'if the msg box is not empty then beep' should conceivably 
execute, but it doesn't.  If/then/else statements are usually called to 
check prior values which the code (script) may/may not have generated.

If/then/else's and repeats are 'structured' (operative word here)
statements in programming, not single line statements.

Bryan K. 'STAKMan' Carter
carterbk@apple.com
<<There are two kinds of every snow flake in the world, it just depends 
upon who's second grade class you are in.>>

mithomas@bsu-cs.UUCP (Michael Thomas Niehaus) (02/22/89)

In article <26177@apple.Apple.COM>, desnoyer@Apple.COM (Peter Desnoyers) writes:
> In article <26170@apple.Apple.COM> dan@Apple.COM (Dan Allen) writes:
> >
> >Structured statements like repeat and if are not allowed currently in
> >the message box.  They must be in a script.
> >
> Is there any particular reason for this? It would be very convenient
> to be able to use these statements from the message box.

I was under the impression that the message box only has one line in it.
If there are more of them hiding somewhere, someone should let all of us
know.  Seriously, it seems to me that you can't use repeat and if and other
multi-line statements just because there is only one line to enter them on.
If this is not true (e.g. if there is any way to put more than one
statement in the message box to be executed at one time) let me know.
(It would be nice to be able to say 'domenu new card; domenu new field', but
that is too *NIX like.  This could also be 'if <whatever>;<dowhatever>;end if'.)

HyperCard never ceases to amaze me.  I don't think I will ever be able to
remember all of the shortcuts (anyone have a good "cheat sheet" that lists
them?) or all of the different HyperTalk constructs and functions.  Now I
can't wait to see version 2.0.  I read in Computerworld that "they" were
considering adding AI type constructs (ala LISP) to HyperTalk.  I may not
like AI languages in general, but this sounds like it could be a lot of fun.
AI for the masses...

Michael Niehaus
Apple Student Rep
Ball State University
UUCP: ..!{pur-ee,iuvax}!bsu-cs!mithomas
AppleLink: ST0374

Disclaimer: No one would be stupid enough to let me speak for them (not even
            this university).