Right now every function that doesn't return anything still needs -> Void on the signature:
def package(pkg_name: String, version: String = "0.0.0") -> Void
name = pkg_name
version_str = version
That's noise. If there's no -> annotation, the return type should be Void by default. A bare def with no return type is obviously void. You shouldn't have to spell it out.
The change:
- If a function signature has no
-> Type annotation, the compiler treats the return type as Void
-> Void still works explicitly if you want it (backwards compatible)
- Functions that return a value still require the annotation
So this would just work:
def package(pkg_name: String, version: String = "0.0.0")
name = pkg_name
version_str = version
def compiler(ver: String)
compiler_version = ver
This came up while writing the Seedfile DSL for the package manager. Every method in the class is -> Void and it's visual clutter that adds nothing.
Right now every function that doesn't return anything still needs
-> Voidon the signature:That's noise. If there's no
->annotation, the return type should beVoidby default. A baredefwith no return type is obviously void. You shouldn't have to spell it out.The change:
-> Typeannotation, the compiler treats the return type asVoid-> Voidstill works explicitly if you want it (backwards compatible)So this would just work:
This came up while writing the Seedfile DSL for the package manager. Every method in the class is
-> Voidand it's visual clutter that adds nothing.