Droid Experiments
2016-05-06 18:14:33 UTC
First of all, please don't be offended on what I'm talking about. Dart is
the coolest programming language ever. Optional typing, great tools and
great built-in libraries are the coolest things that attracts me and keep
me writing Dart more and more. But when I write Dart; I feel many things
missing. As a modern programming language; there are couple of small things
proposed but never implemented. I want to talk them again.
1. First one is the variable declaration. syntax. There is a need for
better variable declaration syntax that enforce immutability.
five letter keywords like 'final' and 'const' are not good. Most people
won't use it even if most of the variables in their program can be treated
as final.
There should be three letter keyword for each.
for ex:
- var : for mutable
- val : for shallow immutable i.e final Point x = new Point(0,0); should be
val x = new Point(0,0);
- def : for deep immutable i.e. const x = [1,2]; should be def x = [1,2];
and also time inference should be fully supported by the specification and
not the implementation do that.
2. Ranges and Tuples are the missing things:
- for(var i=0;i<10;i++) can be replaced by for(var i in 1...10) or for(var
i in 1 to 10)
- tuples should be supported. It should be possible to return multiple
values from a function in one or another way. (take the Kotlin for example
: it has nice data annotation to make small value classes to eliminate the
need for tuples)
3. Switch should be powerful.
- switch should break by default - I think most modern languages go this
way. Showing a error for break is nice but annoying.
- switch statement should support full pattern matching like Rust, Kotlin
and Swift. It would be very much easy if ranges are supported
4. Privacy and underscores should not be enforced.
- Most dynamic languages do not need privacy and Dart should avoid that at
least by specification and in examples. It should have clear guidelines
about where not to play with ugly underscores. it is ok to denote private
variables with underscore prefix but what about methods. they look ugly.
There should be some kind of annotation or something that generate this
kind of source for you for example:
instead of
void _doSomethingAmazing(){} can be used as
@LibPrivate
void doSomethingAmazing(){} to avoid underscores for methods who dislike
them.
5. Inconstancy in static type system
why there are int and num? to maintain a compatibility with JS or are there
any other reasons? Why String is written with first capital letter but int
is not? In Java, it has reasons for that. You should "draw a line"(I still
remember the discussion before with Gilad.") and the line is to make each
type follow Capsfirst.
The whole community would be very happy and get benefited if Dart team
focus on these little details in 2.0 and making end programmers happy and
more productive.
After all:
âItâs the little details that are vital. Little things make big things
happen.â
the coolest programming language ever. Optional typing, great tools and
great built-in libraries are the coolest things that attracts me and keep
me writing Dart more and more. But when I write Dart; I feel many things
missing. As a modern programming language; there are couple of small things
proposed but never implemented. I want to talk them again.
1. First one is the variable declaration. syntax. There is a need for
better variable declaration syntax that enforce immutability.
five letter keywords like 'final' and 'const' are not good. Most people
won't use it even if most of the variables in their program can be treated
as final.
There should be three letter keyword for each.
for ex:
- var : for mutable
- val : for shallow immutable i.e final Point x = new Point(0,0); should be
val x = new Point(0,0);
- def : for deep immutable i.e. const x = [1,2]; should be def x = [1,2];
and also time inference should be fully supported by the specification and
not the implementation do that.
2. Ranges and Tuples are the missing things:
- for(var i=0;i<10;i++) can be replaced by for(var i in 1...10) or for(var
i in 1 to 10)
- tuples should be supported. It should be possible to return multiple
values from a function in one or another way. (take the Kotlin for example
: it has nice data annotation to make small value classes to eliminate the
need for tuples)
3. Switch should be powerful.
- switch should break by default - I think most modern languages go this
way. Showing a error for break is nice but annoying.
- switch statement should support full pattern matching like Rust, Kotlin
and Swift. It would be very much easy if ranges are supported
4. Privacy and underscores should not be enforced.
- Most dynamic languages do not need privacy and Dart should avoid that at
least by specification and in examples. It should have clear guidelines
about where not to play with ugly underscores. it is ok to denote private
variables with underscore prefix but what about methods. they look ugly.
There should be some kind of annotation or something that generate this
kind of source for you for example:
instead of
void _doSomethingAmazing(){} can be used as
@LibPrivate
void doSomethingAmazing(){} to avoid underscores for methods who dislike
them.
5. Inconstancy in static type system
why there are int and num? to maintain a compatibility with JS or are there
any other reasons? Why String is written with first capital letter but int
is not? In Java, it has reasons for that. You should "draw a line"(I still
remember the discussion before with Gilad.") and the line is to make each
type follow Capsfirst.
The whole community would be very happy and get benefited if Dart team
focus on these little details in 2.0 and making end programmers happy and
more productive.
After all:
âItâs the little details that are vital. Little things make big things
happen.â
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.