HyperTalk
Encyclopedia
HyperTalk is a high-level, procedural
Procedural programming
Procedural programming can sometimes be used as a synonym for imperative programming , but can also refer to a programming paradigm, derived from structured programming, based upon the concept of the procedure call...

 programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 created in 1987 by Dan Winkler and used in conjunction with Apple Computer
Apple Computer
Apple Inc. is an American multinational corporation that designs and markets consumer electronics, computer software, and personal computers. The company's best-known hardware products include the Macintosh line of computers, the iPod, the iPhone and the iPad...

's HyperCard
HyperCard
HyperCard is an application program created by Bill Atkinson for Apple Computer, Inc. that was among the first successful hypermedia systems before the World Wide Web. It combines database capabilities with a graphical, flexible, user-modifiable interface. HyperCard also features HyperTalk, written...

 hypermedia program by Bill Atkinson
Bill Atkinson
Bill Atkinson is an American computer engineer and photographer. Atkinson worked at Apple Computer from 1978 to 1990. He received his undergraduate degree from the University of California, San Diego, where Apple Macintosh developer Jef Raskin was one of his professors...

. The main target audience of HyperTalk was beginning programmers, hence HyperTalk programmers were usually called authors, and the process of writing programs was called "scripting
Scripting language
A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...

". HyperTalk scripts are fairly similar to written English
English language
English is a West Germanic language that arose in the Anglo-Saxon kingdoms of England and spread into what was to become south-east Scotland under the influence of the Anglian medieval kingdom of Northumbria...

, and use a logic structure similar to the Pascal programming language.

The case-insensitive language was interpreted at first, but became 'virtually compiled
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

' since HyperCard 2.x. It supports the basic control structures of procedural languages: repeat for/while/until, if/then/else, as well as function and message "handler" calls (a handler is a subroutine, a message handler is a procedure). Data types are transparent to the user, conversion happens transparently in the background between strings
String (computer science)
In formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet....

 and numbers. There are no class
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

es or data structure
Data structure
In computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks...

s in the traditional sense; their place was taken by special string literal
String literal
A string literal is the representation of a string value within the source code of a computer program. There are numerous alternate notations for specifying string literals, and the exact notation depends on the individual programming language in question...

s, or rather "lists" of "items" delimited by commas (in later versions the "itemDelimiter" property allowed choosing an arbitrary character).

Object-Oriented HyperTalk

HyperTalk was not a strictly procedural language. Scripts were associated with objects in HyperCard
HyperCard
HyperCard is an application program created by Bill Atkinson for Apple Computer, Inc. that was among the first successful hypermedia systems before the World Wide Web. It combines database capabilities with a graphical, flexible, user-modifiable interface. HyperCard also features HyperTalk, written...

 files (so-called "stacks"), and HyperTalk allowed manipulating these objects in various ways, changing their properties using the "set" command, for example. Objects were addressed using a syntax close to natural language, where objects were specified relative to the current card, or the of operator was used to specify the absolute position of an object: send "mouseUp" to card button "OK" of card "Veracity". Since buttons and fields could also exist on the background layer, but their content would differ between cards, there were card fields, background fields etc. Objects could be addressed by their name, z-order
Z-order
Z-order is an ordering of overlapping two-dimensional objects, such as windows in a graphical user interface , shapes in a vector graphics editor, or objects in a 3D application. One of the features of a typical GUI is that windows may overlap, so that one window hides part or all of another...

ing number, or by a unique ID number that usually did not change throughout an object's lifetime. To iterate over objects (joinedly referred to as parts in HyperCard 2.2 and later), one simply used their number after querying e.g. the number of card parts.

HyperTalk also provided full-blown script control over the built-in drawing tools, simply by scripting the needed changes in paint tools and simulating mouse movements using the drag from start to end and the click at position commands.

HyperTalk also used messages (i.e. events) sent to objects to handle user interaction. E.g. the mouseDown message was sent to a button when the user clicked it, and mouseUp was sent when the user released the mouse inside it to trigger its action. Similarly, it had the periodic idle message, mouseEnter, mouseLeave, ... and various other messages related to navigation between different cards in a HyperCard stack, as well as user input (keyDown, functionKey, ...), and system events. As far as the scripters were concerned, there were no main event loops like in other procedural programming languages.

Extending HyperTalk

Although the HyperTalk language languished just like HyperCard itself, it received a second lease on life through its plugin protocol, so-called External Commands (XCMDs) and External Functions (XFCNs), which were native code containers attached to stacks (as Macintosh-specific resources
Resource fork
The resource fork is a construct of the Mac OS operating system used to store structured data in a file, alongside unstructured data stored within the data fork. A resource fork stores information in a specific form, such as icons, the shapes of windows, definitions of menus and their contents, and...

) with a single entry point and return value. XCMDs and XFCNs could be called just like regular message and function handlers from HyperTalk scripts, and were also able to send messages back to the HyperCard application. Some enterprising XCMD authors added advanced features like full color support (ColorizeHC, HyperTint, AddColor), multiple special-purpose windows (Prompt, Tabloid, Textoid, Listoid, ShowDialog, MegaWindows), drag and drop support and various hardware interfaces to the language.

Descendants of HyperTalk

Various scripting languages have taken their cues from HyperTalk. They are commonly regrouped in a loosely defined family named xTalk
XTalk
xTalk is a loosely defined family of scripting languages. The father of all xTalk languages is HyperTalk, the language used by Apple's HyperCard environment...

.
  • CompileIt!-Talk – A HyperCard stack and XCMD by Tom Pittman that allowed compiling native 68000 machine code (e.g. for XCMDs and XFCNs) from HyperTalk code, and calling the native Macintosh toolbox routines. CompileIt was bootstrapped
    Bootstrapping (compilers)
    In computer science, bootstrapping is the process of writing a compiler in the target programming language which it is intended to compile...

    , that is, later versions were compiled using earlier versions of itself.
  • Double-XX-Talk (?) – Double-XX was a lightweight HyperCard clone that shipped as an addition to CompileIt! and allowed running XCMDs and XFCNs without HyperCard, and even included a small HyperTalk interpreter.
  • MediaTalk – The language of Oracle Media Objects
    Oracle Media Objects
    Oracle Media Objects, formerly Oracle Card, was a multi-media software development tool for developing multi-media applications, with similar functionality and appearance to Apple Computer' HyperCard....

    , a descendant of Plus, and the first cross-platform HyperCard clone. Furthermore the only one that was truly modular.
  • PlusTalk (?) – of Spinnaker Plus (originally by the German Format Verlag), which was used as the basis for OMO.
  • SenseTalk
    SenseTalk
    SenseTalk is an English-like scripting language derived from the HyperTalk language used in HyperCard. SenseTalk was originally developed as the scripting language within the HyperSense multimedia authoring application on the NeXTStep and OpenStep platforms...

     – The language of the NeXT-originated HyperSense and the VNC-based testing tool Eggplant.
  • SuperTalk
    SuperTalk
    For the American radio station, see Supertalk Mississippi.SuperTalk is the scripting language used in SuperCard. SuperTalk is a descendant of HyperTalk.-Additional syntax:...

     – The language of SuperCard
    SuperCard
    SuperCard is a high-level development environment that runs on Macintosh computers, under OS 8 and 9, and OS X. It is inspired by HyperCard, but includes a richer language, a full GUI toolkit, and native color .The programming language used by SuperCard is called SuperTalk, and is largely based on...

    , the first HyperCard clone, by Bill Appleton. Appleton also wrote the popular World Builder
    World Builder
    World Builder is an authoring system for point-and-click adventure games. It was released in 1986 by Silicon Beach Software and had already been used for creating Enchanted Scepters in 1984. In 1994 World Builder along with Course Builder, SuperCard and HyperDA was cited as the reason Appleton was...

     adventure construction kit.
  • revTalk – The language implemented in the Revolution development environment itself derived from the Unix-originated HyperCard clone MetaCard
    MetaCard
    MetaCard was a cross-platform, commercial GUI toolkit. MetaCard included an IDE and had its own language, MetaTalk. From the MetaCard Corporation website: "The MetaTalk language has all the features common to third-generation languages like C/C++/Java but has a much simpler syntax."All the Metacard...

    , that now runs on Classic Mac OS, Mac OS X, Windows, Linux and Solaris.
  • XION - Originally the language of an open-source HyperCard clone that never materialized. Now implemented as OpenXION.


As well as second-level clones like
  • AppleScript
    AppleScript
    AppleScript is a scripting language created by Apple Inc. and built into Macintosh operating systems since System 7. The term "AppleScript" may refer to the scripting system itself, or to particular scripts that are written in the AppleScript language....

     – the main scripting language of Apple's Mac OS.
  • Lingo – the programming language of Macromedia Director started out with an xTalk-like syntax, although current versions went into a direction more like JavaScript.
  • The (unnamed) scripting language of Em Software's Xdata and InData, data-publishing plug-ins for QuarkXPress and Adobe InDesign.


Many method names first popularized by HyperTalk made it into later languages, such as the onmouseup event handler in JavaScript. Although Asymetrix ToolBook is often also considered a HyperCard clone, its scripting language apparently bears little resemblance to HyperTalk.

These clones and dialects (commonly referred to under the moniker of xTalk
XTalk
xTalk is a loosely defined family of scripting languages. The father of all xTalk languages is HyperTalk, the language used by Apple's HyperCard environment...

-languages) added various features to the language that are expected from a modern programming language, like exception handling, user-defined object properties, timers, multi-threading and even user-defined objects.

Some sample scripts


on mouseUp
put "100,100" into pos
repeat with x = 1 to the number of card buttons
set the location of card button x to pos
add 15 to item 1 of pos
end repeat
end mouseUp



on mouseDown
put "Disk:Folder:MyFile" into filePath -- no need to declare variables
if there is a file filePath then
open file filePath
read from file filePath until return
put it into cd fld "some field"
close file filePath
set the textStyle of character 1 to 10 of card field "some field" to bold
end if
end mouseDown



function replaceStr pattern,newStr,inStr
repeat while pattern is in inStr
put offset(pattern,inStr) into pos
put newStr into character pos to (pos +the length of pattern)-1 of inStr
end repeat
return inStr
end replaceStr

See also

  • Inform 7 – a programming language with similarly English-like syntax
  • Pantechnicon HyperTalk Wiki pages – excellent language reference (control structures, events, built-in functions, etc.)
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK