-
Notifications
You must be signed in to change notification settings - Fork 224
Open
Description
This is more of an idea of improvement in documentation rather than an error report.
Hi, Dart adopted a syntax where a variable type is put before the variable name, like C and Java:
const int a = 0;
Given that
- the newer-ish languages like TypeScript, Python (with type hints), Swift, Kotlin, Rust, and Google's very own Go all elected to put types after variable names (and consequently have a dedicated keyword to declare functions). People wrote a lot to justify this type-last syntax, like
- simpler parser,
- similarity to English syntax,
- better readability (like Go's arguments about pointers, which don't completely apply to Dart of course),
- optional type declaration due to type inference, etc.
- users working on mobile apps tend to be used to Swift and Kotlin, and they form the main target user base of Flutter (especially before desktop support),
It feels there's a specific technical reason for Dart to make this choice, not just taste or frugality to save a few characters. For educational purposes, could you document why it is so? (like this question and answer, which is mentioned in the official doc)
Thanks.
cedvdb
Metadata
Metadata
Assignees
Labels
No labels