[comp.sys.mac.hypercard] HyperCard bug <- No, it's a feature.

winkler@Apple.COM (Dan Winkler) (03/01/88)

There is no constant in HyperTalk named "newline", only "return"
and "linefeed".  When you write:

  read from file f until newline

you are not providing a valid expression after the "until".  So, in a
never ending battle to figure out what the heck you meant, the
HyperTalk interpreter guesses that you might forgotten a pair of
quotes, and transforms the line into:

  read from file f until "newline"

Having thus succeeded in wrenching the line into something syntactically
correct, the interpreter passes control to the read command.  The read
command then does its job, which is to read up to the first character
of the until string, namely "n".  (The reason that read only reads up
to the first character, is that that is all the underlying Macintosh
file system has built in.)

I call the above construction an "unquoted literal".  It let's you
do things like

  get field fred      instead of      get field "fred"
  go to clip art      instead of      go to "clip art"

Unfortunately, I'm still the only person in the world who knows many
secrets of HyperTalk, such as exactly where unquoted literals are
allowed, where they're not, where they are restricted to single tokens,
and where they can be multiple tokens.  Here are a couple rules of
thumb:

  1. Unquoted literals are not allowed as sources in an expression.
     (I could have allowed them, but that would be REALLY dangerous.)
  
     put "hello" && "there"  -- quotes are required

  2. Unquoted literals can only be a single token except for stack names.
     This is because once I decide to take more than one token as unquoted,
     I never know where to stop and so go all the way to the end of the line.
     Stack names are the only thing that occur at the end of the line often
     enough to make this worth it.

     go to stack "clip art"  -- quotes are optional
     put field "clip art" into it  -- quotes are required

Unquoted literals exist only for lazy typists and forgetful beginners.
If you can at all manage to supply the quotes, it's much better that
way, mainly because statements that use unquoted literals can suddenly
begin to behave differently if you ever define a variable with the same
name as the unquoted literal.  Fortunately, only the handler can define
things in its scope, but it's still dangerous.

greely@teak.cis.ohio-state.edu (J Greely) (03/01/88)

This discussion recalls to mind the question, "When is there going to
be a HyperCard book that tells you *everything* about how to _program_ HC?"

We've had Goodman's book, a weighty tome that was purchased because
there was nothing else on the market.  It is oversized, incomplete,
and *very* poorly arranged (partially a function of its sheer volume).
Has anyone actually needed anything before page 341?  Most of the
first half of the book is aimed at computer illiterates who don't know
how to point and click, and is concerned with such *vital* information
as how to use MacPaint-style tools.

  I'm not saying that there aren't people who don't need this, but
most of them will be frightened away by the size of this thing (You
mean, I've got to read *all that* to understand HyperCard?  Forget
it!), and those who aren't will get turned off long before they get to
the section on HyperTalk.  Am I the only one who felt cheated by
purchasing a book that was effectively half-blank?

  Moving on, we have a *new* book (which I haven't been able to find
yet), which is described as roughly equivalent to Goodman's, but
slightly more useful.

  Then there's Apple's entry, available only from APDA.  It has
information on XCMDs and XFCNs, but costs more (counting the
membership) than the others, and which I've yet to hear anything
really good about.

  Is there, or will there be, a *real* book on HC?  Written for
someone who knows the Mac, knows how to program, and couldn't care
less about learning to double-click?  Accurate?  Complete (unlike
Goodman's)?  That is not a mindless rehash of the help stack? (which,
by the way, is almost useless.  It has all this information about
HyperTalk, in a reasonable format, while the editor is a modal dialog
box.  Useless!)

  <sigh>I suppose it is to be expected that the machine-that-needs-no-
manual is incapable of producing a good one.  I've been using the Mac
since it was released, and the only manuals I've ever needed were for
language products, for which you needed implementation information.
HyperCard is extremely easy to use, very well designed, and
(potentially) quite powerful.  Why can't we have a manual that's the
same way?

-=-
				      -j,  greely@satcom3.cis.ohio-state.edu
			The Ohio State University, somewhere in Ohio.  
			(Just look for the bars, you'll find it)
 "Sir Francis Drake circumsized the world with a 100-foot clipper."

kurtzman@pollux.usc.edu (Stephen Kurtzman) (03/01/88)

In article <7500@apple.Apple.Com> winkler@apple.UUCP (Dan Winkler) writes:
>...
>I call the above construction an "unquoted literal".
>...
>Unfortunately, I'm still the only person in the world who knows many
>secrets of HyperTalk, such as exactly where unquoted literals are
>allowed, where they're not, where they are restricted to single tokens,
>and where they can be multiple tokens.
>...
>Unquoted literals exist only for lazy typists and forgetful beginners.
>If you can at all manage to supply the quotes, it's much better that
>way, mainly because statements that use unquoted literals can suddenly
>begin to behave differently if you ever define a variable with the same
>name as the unquoted literal.  Fortunately, only the handler can define
>things in its scope, but it's still dangerous.

As stated, if an unquoted literal becomes a valid variable name, the
HyperTalk command will be interpreted in a different way. It is also
wise to remember that a misspelled variable name will be interpretted as
an unquoted literal.

While the unquoted literal was added for beginners, it is a pain for both
the experienced programmer and the beginner alike. It took me quite a
while to discover a misspelled variable name -- HyperCard was working
it just kept going to the wrong card. This inconsistent interpretation,
in which the same statement will have a different meaning based on the
set of variable defined in the stack, is enough to make beginners give
up in frustration. It is misfeatures such as the unquoted literal that
can make programming in HyperText a pain.

Dan, since you are upset at the quality of HyperText books on the market,
and you admit you are one of the few who knows all the ins-and-outs, please
tell your marketing people at Apple to hire some technical writers to
produce a real HyperText manual. With you help, I am sure they can produce
a manual that will meet even your high standards.

cca@pur-phy (Charles C. Allen) (03/02/88)

In article <7500@apple.Apple.Com>, winkler@Apple.COM (Dan Winkler) writes:

> So, in a never ending battle to figure out what the heck you meant,
> the HyperTalk interpreter guesses that you might forgotten a pair of
> quotes, and transforms the line into...

How helpful.  Any interpreter/compiler which silently changes the
meaning of the source provided to it is going to frustrate many, many
programmers.  Me included (I've been bitten by this "feature" before).

> I call the above construction an "unquoted literal".  It let's you
> do things like...
> [stuff deleted]
> Here are a couple rules of thumb:...

Sigh.  Whatever happened to simplicity as a goal for programming
languages?  Just REQUIRE the silly "'s, get rid of unquoted literals,
and all this would become moot.  I simply can't believe that simpler
is not better in this case.

On a related note, I would like to see required declarations for all
variables (global variables have to be declared, I just want to extend
that to local variables as well).  The script could be checked for
consistency when OK is clicked.  The next step would be an incremental
compiler....

While I'm dreaming, I'd also like to see variables which have a scope
for the script they're declared in (card variables in the card script,
button variables in the button script, etc.).

Charlie Allen		cca@newton.physics.purdue.edu
			cca@fnal.bitnet
			..pur-ee!newton!cca

kwallich@hpsmtc1.HP.COM (Ken Wallich) (03/02/88)

Stephen Kurtzman writes:

>up in frustration. It is misfeatures such as the unquoted literal that
>can make programming in HyperText a pain.
                              ^^^^
>Dan, since you are upset at the quality of HyperText books on the market,
                                                 ^^^^
>and you admit you are one of the few who knows all the ins-and-outs, please
>tell your marketing people at Apple to hire some technical writers to
>produce a real HyperText manual. With you help, I am sure they can produce
                     ^^^^
>a manual that will meet even your high standards.
----------

I see:  A soap box
> up
You are on the soap box.

Well, while I'm here (:-),

HyperTALK, not HyperText, is the name of the poorly documented "programming"
language for HyperCard.  HyperText is a phrase coined by Ted Nelson to
refer to the entire 'Hyper' concept of information organization.  Since the
whole of computerdumb is getting HYPER, we must keep our terms straight.

> down
You are no longer on the soap box.

--------------------
Ken Wallich			*My views are mine, and mine alone*
Consultant			"No mystical energy field controls MY destiny"
DCI 				kwallich@hpsmtc1.HP.COM
@Hewlett Packard		...hplabs!hpsmtc1!kwallich

"Stories of tortures, used by debauchers, lurid, licentious, and vile
 make me smile"

8hum190@violet.berkeley.edu (03/06/88)

In article <1007@pur-phy> cca@pur-phy (Charles C. Allen) writes:

>On a related note, I would like to see required declarations for all
>variables (global variables have to be declared, I just want to extend
>that to local variables as well).  The script could be checked for
>consistency when OK is clicked.
>
>Charlie Allen		cca@newton.physics.purdue.edu
>			cca@fnal.bitnet
>			..pur-ee!newton!cca

I just want to put my vote in for *not* requiring declarations of all variables.
While I can see reasons for wanting to do this, I have to say that one thing
(among many) which makes HyperTalk accessible to "the rest of us" is the
ability to grab a new variable at a moment's notice and use it in a script.
Top-down programming is fine (nay, necessary) for major projects which are
done all at once, but bottom-up is more in the spirit of an "erector set
for applications".

--Elliot Wilen

edwards@bgsuvax.UUCP (Bruce Edwards) (03/08/88)

In article <7500@apple.Apple.Com>, winkler@Apple.COM (Dan Winkler) writes:
> 
> Unfortunately, I'm still the only person in the world who knows many
> secrets of HyperTalk, such as exactly where unquoted literals are
>

Why is this Dan? I'm  willing to gamble on what the Russians might do if
that kinda information gets public...about APPLE?  How bout a nice little
Stack in this newsgroup just chocked full of great little insights about
HyperTalk that we're just dying to know about. This would really be in
keeping with Bill's whole philosophy about getting the full capability
of HC to "the people"...right?

Also....thanks for HyperTalk it has made stay up late at night and play
with computers again....still a kick.


      'These are only the shadowlands.' C.S. Lewis 
      ----------------------------------------------------------------- 
        Ken Jenkins as guest @
        
        CSNET: edwards@bgsu
      ARPANET: edwards%bgsu@csnet-relay
         UUCP: cbosgd!osu-cis!bgsuvax!edwards 
        
      US Mail:
	c/o Century Marketing Corp.
            12836 S. Dixie Hwy.
            Bowling Green , OH 43402
            
        Phone:
            In Ohio 1-800-821-5409
        Out of Ohio 1-800-537-9429
                 or 1-419-354-2591
      -----------------------------------------------------------------