Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex Data Types? #96

Open
nurbles opened this issue Mar 15, 2024 · 0 comments
Open

Complex Data Types? #96

nurbles opened this issue Mar 15, 2024 · 0 comments

Comments

@nurbles
Copy link

nurbles commented Mar 15, 2024

Feature Request
While searching for a BASIC language manual that might help me understand how to use all the undocumented MY-BASIC built-in functions, I ran across this feature from BASIC09 (1984, Microware System Corporation) and with there was something like it available in MY-BASIC as it would be perfect for my needs:

COMPLEX DATA TYPES

The TYPE statement can be used to define a new data type as a "vector" (a one—dimensional array) of any atomic or previously—defined types. For example:

TYPE employee_rec = name:STRING; number (2):INTECER; malesex:BOOLEAN

This structure differs from an array in that the various elements may be of mixed types, and the elements are accessed by a name instead of an array index. For example:

DIM employee_file(250): employee_rec
employee_file(1).name := "Tex"
employee_file(20).number(2) := 115

The complex structure gives the programmer the ability to store and manipulate related values that are of many types, to create "new" types in addition to the five atomic data types, or to create data structures of unusual or size. Additionally, the position of the desired shape element in complex—type storage is known and defined at "compile time" and need not be calculated at "run time". Therefore, complex structure accesses may be slightly faster than array accesses. The elements of a complex structure may be copied to another similar structure using a single assignment operator (i.e., :=). An entire structure may be written to or read from mass storage as a single entity (e.g., PUT $2, employee_file). Arrays or complex structures may be elements of subsequent complex structures or arrays.

Reference: Pages 7-8/7-9 in:
https://colorcomputerarchive.com/repo/Documents/Manuals/Programming/BASIC09%20Programming%20Language%20Reference%20Manual%20-%20Revision%20H%20(Microware%20System%20Corp).pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant