dhh1128 / intent

the intent formal language
https://intentlang.org
2 stars 1 forks source link

support elision of param names when data type is enough #56

Open dhh1128 opened 10 years ago

dhh1128 commented 10 years ago

Imagine a function like this:

TakeVehicleToJunkyard(IVehicle & vehicle, Junkyard & junkyard);

Such a function is not clarified at all by having parameter names. This would be just as clear:

TakeVehicleToJunkyard(IVehicle &, Junkyard &);

In intent, I'd like the latter form to be natural. The name of a class will be an identifier, probably not capitalized, so a func decl might look like this:

Take vehicle to junkyard:
    takes:
        - vehicle
        - junkyard

Since param names match data type names, the type of the params is implied. The class names "vehicle" and "junkyard" get hidden by the param names, but can be recovered by using vehicle:: and junkyard:: instead of vehicle. and junkyard.

If we support infix notation for functions, the decl gets even slicker:

Take |-vehicle to |-junkyard:
    code: ...