tenachi@loria.crin.fr (03/08/90)
Hi there, I began using HyperCard a littel time ago to develop a CAI software in the domain of managment. I have a question concerning data structures in HyperTalk. I wondred if we have the ability to handle non simple data types such as arraies, records, pointers.. like in classic languages. Until now I haven't found something dealing with this in the documentation. Thank you. Abd-ed-daim. ---------------------------------------------------------------------- A.Tenachi | Email : tenachi@loria.crin.fr CRIN, Equipe Informatique et Formation | BP. 239, 54506 Vandoeuvre-les-Nancy | France | ----------------------------------------------------------------------
jdevoto@Apple.COM (Jeanne A. E. DeVoto) (03/09/90)
In article <1779@loria.crin.fr> tenachi@loria.crin.fr writes: > [...] I have a question concerning data structures >in HyperTalk. I wondred if we have the ability to handle non simple data types >such as arraies, records, pointers.. like in classic languages. Until now I >haven't found something dealing with this in the documentation. Variables in HyperTalk are untyped, so there is not e.g. an array type as such. However, you can do most (if not all) of the work of records and (simple) arrays by using chunk expressions (word, line, item, character) within a variable to structure your data. For instance, suppose you wish to create a record consisting of the name, ID, and number of a card. This can be done by storing the name in line 1 of your variable, the ID in line 2, and the number in line 3. The values are accessed directly (e.g. "get line 3 of myVariable"). Arrays can be created in similar fashion. Suppose you want a two-dimensional array: one simple way to accomplish this is to use item number as one index and line number as the other. To access the [4,7]th item of the array, you would use the chunk expression "item 4 of line 7 of myArray". The main limitation I find is that the data can't contain the characters used as delimiters; if you're using items as array elements, your data can't contain commas, for instance. -- ====== jeanne a. e. devoto ======================================== jdevoto@apple.com | You may not distribute this article under a jdevoto@well.UUCP | compilation copyright without my permission. ___________________________________________________________________ Apple Computer and I are not authorized | CI$: 72411,165 to speak for each other. | AppleLink: SQA.TEST
jk3t+@andrew.cmu.edu (Jonathan King) (03/10/90)
jdevoto@Apple.COM (Jeanne A. E. DeVoto) writes: > In article <1779@loria.crin.fr> tenachi@loria.crin.fr writes: > > [...] I have a question concerning data structures > >in HyperTalk. I wondred if we have the ability to handle non simple data types > >such as arraies, records, pointers.. like in classic languages. Until now I > >haven't found something dealing with this in the documentation. > > Variables in HyperTalk are untyped, so there is not e.g. an array type > as such. This isn't the primary issue, since there are programming languages which are not at all strongly typed but which certainly do have data structures that are much more useful than what you can hack together in Hypertalk. Jeanne De Voto continues her message with examples of how some useful data structures can be faked in Hypertalk, but the problem still remains that these data types and structures are not at all abstract; you just can't refer to the "last_name" field of a record without quite a bit more Hyperhackery. This really is a serious problem with Hypertalk as it stands. I hope that it might be fixed in a future version of Hypercard. jking