I like using Record in Maple. It allows me to collect related variables to pass around inside one object. (Like with Pascal or Ada records or C struct).
But I find myself copying the record definition over and over everywhere I want to use the same specific record layout.
Is there a way to define specific record layout somewhere, may be as a type and give it a name, and then in each proc I want to make a variable of this record type, just tell Maple that this variable is a record of that type so I do not have to explicity define the record there each time?
Here is a simple example to make it more clear
foo:=proc() #some proc that uses same Record layout
S:-name:="joe doe 1";
boo:=proc() #another proc that wants to use same Record layout
S:-name:="joe doe 2";
These proc's can be anywhere, such as inside package or module, either local or exported.
I just want to avoid having to type S:=Record('name','age'); Each time. I want to tell Maple that a local variable is of this specific Record layout, without having to type the layout explicitly.
This way, when I add new field to this Record, I just have to do it in one place and not in 10 places in the code.
I think I need to add a new type? But do not know how to do this. I hope the question is clear. If not, will add more information.