marekjm / viuavm

Parallel virtual machine designed to reliably run massively concurrent programs
https://viuavm.org/
GNU General Public License v3.0
71 stars 11 forks source link

Function types #107

Closed marekjm closed 8 years ago

marekjm commented 8 years ago

Available information about function's type is not enough. Currently, only Function type is returned.

Type of a function should include:

Arity can be trivially detected by the compiler by counting parameters. It can also be explicitly given.

Return type can also be detected, in case it is not given explicitly. Ambiguous return types should be a warning.

Parameter types should be spelled explicitly.

marekjm commented 8 years ago

This will probably mean that type descriptions should be made available to the compiler.

marekjm commented 8 years ago

Proposed syntax (a 30 seconds idea): .function: name::of::the::callable / minimum-arity (Parameter, Types) -> ReturnType

marekjm commented 8 years ago

This issue will require a real compiler to be written for the machine. Or at least the assembler will have to be beefed up with some more features.

marekjm commented 8 years ago

I decided not to beef the assembler up since I started writing a compiler for higher-levelish language into Viua assembly. However, functions' types can be encoded in bytecode as debugging information.