-
Notifications
You must be signed in to change notification settings - Fork 0
Remove mandatory -> Void return type annotation #40
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestmediumShould get done, not urgentShould get done, not urgentparserParsing, syntax, lexerParsing, syntax, lexertype-systemType checker, inference, generics, traitsType checker, inference, generics, traits
Description
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
-> Typeannotation, the compiler treats the return type asVoid -> Voidstill 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestmediumShould get done, not urgentShould get done, not urgentparserParsing, syntax, lexerParsing, syntax, lexertype-systemType checker, inference, generics, traitsType checker, inference, generics, traits