A Maple Object can be used a record type in other languages, such as Ada or Pascal. This example shows how to define a local type inside a proc and use it as record.
restart; foo:=proc(the_name::string,the_age::integer)::person_type; local module person_type() #this acts as a record type option object; export the_name::string; export the_age::integer; end module; local person::person_type:=Object(person_type); person:-the_name:=the_name; person:-the_age:=the_age; return person; end proc; o:=foo("joe doe",100); o:-the_name; "joe doe" o:-the_age; 100
In the above person is local variable of type person_type. In the above example, the local
variable was returned back to user. But this is just an example. One can declare such
variables and just use them internally inside the proc only. This method helps one organize
related variables into one record/struct like type. The type can also be made global if
needed.