There has been some debate re using 'val' instead of 'final' for immutable bindings.
+1 for immutable params.
But I prefer final to val. ;-)
--
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
+1 for immutable params.
Why not just dropping the "final" keyword and make it the default for identifier declarations ?
The Dart team has been very clear in their intentions and talk that they are focusing on people that are familiar with C/C++ style languages. They have already chosen their target audience, so they built the language syntax around that.
The core language syntax IS NOT CHANGING for at least a few months. The team is working on hammering down everything to launch Dart 1.0. Maybe sometime after that they may consider language changes, but they have said for the last 6 months that there will be no more major syntax or core changes until after 1.0. So I'm guessing they are going to wait to see how the language is received at that point and decide what they want to do.
K.
> - aid the DartVM with immutable loop var. The whole point of Dart is a language that works with the DartVM - not against it.In majority of cases that would not aid VM even a single bit: in fact local variables completely disappear when optimizing compiler does its job.
K.--
> Therefore anything which assists compilation is good.Let me repeat again: for local variables it does *not* really assist, there are *no* local variables after SSA construction. If you make all variables immutable that would certainly assist by allowing compiler to skip SSA construction phase, but with a mixture of immutable and mutable variables there is not much of help.
K.--
On Sunday, May 19, 2013 8:12:26 AM UTC-5, kc wrote:On Sunday, May 19, 2013 1:37:53 PM UTC+1, Gen wrote:Why not just dropping the "final" keyword and make it the default for identifier declarations ?Too unfamiliar. It would be like Python - would need a nonlocal keyword.There's nothing wrong with familiar - it's just that Dart have choosen *'familiar with Java/C#* - when developers are moving *away* from these languages.The sweet spot for syntax is succinct, readable - and by default the right thing is done. Without being overly restrictive.K.
The Dart team has been very clear in their intentions and talk that they are focusing on people that are familiar with C/C++ style languages. They have already chosen their target audience, so they built the language syntax around that. Syntax is just a small part of a language, and once you get used to it, it's easy to code in any language. If start changing things now (especially something as big as 'final'), it will confuse a lot of people.
The core language syntax IS NOT CHANGING for at least a few months. The team is working on hammering down everything to launch Dart 1.0. Maybe sometime after that they may consider language changes, but they have said for the last 6 months that there will be no more major syntax or core changes until after 1.0. So I'm guessing they are going to wait to see how the language is received at that point and decide what they want to do.
I do not think that Lars and Gilad love the C syntax. It is just a common syntax without major flaws.
Lars wanted to have the flexible and classic programming style from the C family including Java and Javascript.
But there is no reason not to change one or the other superfluous keyword.
Syntax is not where the effort of transition lies, but the libraries and async and isolates instead of classic threads.