Meaning of autotype

GP Script has the Autotype keyword which is mentioned in the manual as well as the function list. Unfortunately it is not explained in the manual and as far as I see autotyped functions in the function manual seem to have predetermined parameter and return types.

So: What does it do?

With the exception of automatic conversion from integers to doubles (which I’m actually mixed about!), GP Script is strongly typed. That means you cannot pass an integer or a boolean (say) to a function that requires a string argument. However, if you look at the declaration for Print:

function Print (s : String) Autotype

you’ll note that it takes a single String argument. However, you can in fact pass integers, doubles, strings and MidiMessages into that function and they will be printed. So the idea of Autotype is to allow the compiler to try to convert from those other types into Strings without your having to explicitly do it yourself. It’s not always possible in which case you’ll get a “Incompatible types” error from the compiler

1 Like

Thanks! :slight_smile: