News for hackers. Stuff that matters.
Re:Dart language by timclark on Monday October 10, 2011 @03:31AM (#3092637)
Aaaarghhh! It is full of semicolons.

Is it really necessary in the 21st century to create a language that terminates lines with semicolons? I am sure I have seen some other languages in the past that get by just fine without them.

Re:Dart language by munificent on Monday October 10, 2011 @04:01AM (#3092726)
The language isn't done yet. Now is the time to let us know if you want semicolons to go away. I know some of us on the team do too, but public interest will help a lot.
Re:Dart language by jules on Monday October 10, 2011 @07:43AM (#3093339)
Please make the language a nice target for other languages to compile to. Better yet, make a lower level bytecode language that Dart can compile down to as well as other languages.

For example value types would be excellent. Even better would be explicit regions, but I'm sure that's not going to happen.

Also, please fix this:

The type system is unsound, due to the covariance of generic types. This is a deliberate choice (and undoubtedly controversial). Experience has shown that sound type rules for generics fly in the face of programmer intuition. It is easy for tools to provide a sound type analysis if they choose, which may be useful for tasks like refactoring.

And add proper generics. If sound type rules fly in the face of programmer intuition, that means that the programmer's intuition is wrong. The proper response is to inform the programmer of his mistake at compile time, and not to silently ignore it and add dynamic type checks on every contravariant use of generics including array access! That is worse on both programmer productivity because the programmer expects that his program is type safe when he is using static types and on runtime speed because the dynamic checks slow down all programs needlessly. Dart already has dynamic typing; use that when you want it, not something that looks like static typing but really is dynamic typing.

Another thing that would be awesome is if you provide a compact binary format for code.

Re:Dart language by danmaz74 on Monday October 10, 2011 @04:19AM (#3092804)
I'll give you my votes then:

- no braces where avoidable, no semicolons where avoidable

- release early a free, open source reference development environment that really helps in developing with Dart. The biggest pain with Javascript, imho, is in the lack of development tools really thought out for it, and not just an adaptation of Java/C/whatever other editors

  - if you develop said IDE as a web-IDE, even better (why not writte in dart itself?)

  - give as many inobtrusive visual cues as possible to easily see tab alignment, syntax coloring, etc.

  - integrate unit testing facilities in the IDE
Re:Dart language by munificent on Monday October 10, 2011 @04:27AM (#3092833)
I like everything you propose here. Dart is earlier in development than I think most people realize, and I really hope we can get to something like what you're listing. Definitely self-hosting and a self-hosted IDE would be on my love-to-have list. As a testing nerd, integrating testing would definitely be on it too.
Re:Dart language by danmaz74 on Monday October 10, 2011 @04:57AM (#3092935)
A good development environment is something where you could really differentiate yourselves, and I guess you could very easily integrate introspection and analysis features into chrome to help with it.

I've been thinking for years that if I ever were to develop a new language, I would start from developer usability first - I think there is much more to innovate there than in the core language features, nowadays. Developer usability is tightly coupled with the development tools the developer can use, not just with abstract language features. And especially for web development, you can't think only about top of class developers.

As I'm at it, I'll write here my dream feature of any language and IDE - not knowing if it is really feasible, but it doesn't look really impossible to me. Use case:

- You run your unit tests

- An assertion fails/there is an error

- A debugger brings you to where the problem is

- You can step back from where you are, make changes on the fly to your code and the tests, and step forward to the assertion/error again.

I guess that with a VM, and excluding some operations that depend from external status and which are destructive, this could be possible, and it could allow an incredible speedup in development...

Re:Dart language by drothlis on Monday October 10, 2011 @08:44AM (#3093509)
Certainly feasible: Smalltalk debuggers do this. And Smalltalkers (allegedly) use a workflow just like you describe.
Re:Dart language by cwp on Tuesday October 11, 2011 @12:33AM (#3097119)
Yup. I often do something like this:

  - write a test for a method that isn't there yet
  - run it, get a red bar, as expected
  - run it in debug mode, and get a debugger
  - write the method implementation in the debugger
  - possibly write other methods that the new method calls, also in the debugger
  - resume the program, get a green bar
Writing code in the debugger is great, because you've got all the runtime state right in front of you, and you can step through the code you're working on. I'd love, love, love to see this in Dart.
Re:Dart language by danmaz74 on Wednesday October 12, 2011 @06:13AM (#3102290)
But, is it possible to step backwards from the current state of the VM, to execute a changed code?
Re:Dart language by danmaz74 on Monday October 10, 2011 @10:46AM (#3093972)
I read about this, and even tried downloading squeak once, but didn't find it very compelling. I admit that I might not have given it the time it needed, though...
Re:Dart language by drothlis on Tuesday October 11, 2011 @08:13AM (#3098220)
A few weeks ago I whipped up this 3-minute video showcasing a Smalltalk class browser, method finder, and debugger: http://vimeo.com/27850933
Re:Dart language by clownz0r on Monday October 10, 2011 @04:27AM (#3092830)
You raise a good point. I'd like to see more about testing Dart.
Re:Dart language by munificent on Monday October 10, 2011 @04:30AM (#3092847)
We have a rudimentary unit test framework [1] that we've been using for the samples, though we're still playing with different styles. Personally, I'm fond of the Jasmine-inspired stuff I tried to slap together here [2]. This is of course different from the testing infrastructure for the language itself, which is its own thing.

    [1] https://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/#dart%2Fclient%2Ftesting%2Funittest
    [2] https://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/client/tests/client/view/ViewTests.dart
Re:Dart language by clownz0r on Monday October 10, 2011 @04:39AM (#3092879)
Thanks! I will take a look at these.
Re:Dart language by secoif on Monday October 10, 2011 @04:54AM (#3092922)
In terms of a language, it looks like a horrible step back into the 90s. What we need is the language to be terse, and clean with lots of built-in functional utilities for manipulating data structures and objects/modules/classes/etc. Ideally, take the best bits from ruby/coffeescript/coco/python and couple them with high quality tooling. Many of the most innovative minds are flocking to these languages for good reason.
Re:Dart language by secoif on Monday October 10, 2011 @04:57AM (#3092933)
Also +1 for ability to extend the language itself so we can code in DSLs. This is so powerful.
Re:Dart language by edanm on Monday October 10, 2011 @04:13AM (#3092782)
I love Python. I prefer working without semicolons.

But from a new language standpoint, it's not worth dropping them. The ridiculous arguments that come out of it, the programmers who refuse to use the language because of it, they're things that can and should be avoided by using semicolons like most languages.

I'll never understand why programmers care so much about this, but hey, that's life.

Re:Dart language by secoif on Monday October 10, 2011 @04:39AM (#3092878)
Programmers care about it because it adds extra noise to your program.

If you semantically, and naturally, communicate "end of statement" with a line break to human readers, why should you have to say it again with a semicolon to the compiler? Programming languages should focus on being DRY.

Re:Dart language by surrealize on Monday October 10, 2011 @04:59AM (#3092944)
For human readers we use periods, not line breaks.
Re:Dart language by sambeau on Monday October 10, 2011 @06:24AM (#3093134)
Code is more like poetry.
Re:Dart language by sambeau on Monday October 10, 2011 @07:52AM (#3093364)
That was not a flippant remark.

Lines of code are clauses not sentences. This is also true of poetry.

A sentence is more akin to a stanza in poetry, and a function in code.

While I could entertain an argument for lines ending in commas and for functions to end with periods there is no reasonable argument for lines to end with periods (is there a language where a line is equal to a function?).

APL, and to some degree Perl, are examples of languages where to you might consider a period half-way through a line.

Re:Dart language by secoif on Monday October 10, 2011 @07:57AM (#3093374)
The context is programming, not writing.
Re:Dart language by j-kidd on Monday October 10, 2011 @07:22AM (#3093277)
Semicolon makes it possible to do jQuery-style chaining with the least noise. I think frequent-backslash is uglier than always-semicolon.
Re:Dart language by gf3 on Monday October 10, 2011 @09:51PM (#3096720)
Semi-colons do not enable this feature. Multi-line chaining works just fine sans-semis.
Re:Dart language by methodin on Monday October 10, 2011 @07:23AM (#3093281)
I very often use and see "single" line of code flow onto more than one line for readability. So often a line break is definitely not enough.
Re:Dart language by secoif on Monday October 10, 2011 @08:00AM (#3093381)
I wasn't suggesting exclusive use of linebreak… Semicolon with no linebreak is fine, but semicolon + linebreak is 100% additional cruft. One or the other. Say it once.
Re:Dart language by arctangent on Monday October 10, 2011 @06:49AM (#3093189)
Please make semicolons and braces optional. Unless they are explicitly required for marking blocks and endlines they are just wasted characters to people from prettier languages :-)

For those people who come from "ugly" languages like Java you could have a feature in the IDE which auto-inserted (and of course auto-removed) the braces/semicolons so that they felt at home too.

Re:Dart language by nasmorn on Monday October 10, 2011 @07:27AM (#3093293)
Are there really people that feel like the lack of adding semi-colons is bad? I understand why you want to be able to optionally terminate a line early for terseness but being required too is just more work. But then I also know people who wax on about the meditative aspects of dish washing instead of buying a machine to do it.
Re:Dart language by velagale on Tuesday October 11, 2011 @06:11PM (#3100580)
"Java" ugly ? Please name some beautiful languages.
Re:Dart language by tjgillies on Thursday October 13, 2011 @03:23AM (#3106466)
Ruby
Re:Dart language by lisperforlife on Monday October 10, 2011 @04:26AM (#3092826)
Yes please. No semicolons. And please make it look a lot more like CoffeeScript than Java.
Re:Dart language by johnx123-up on Monday October 10, 2011 @07:17AM (#3093255)
Am I in the minority? I madly in love with braces and semicolons. And, madly hate Pascal, Python & Ruby for the absence of them.
Re:Dart language by ajanuary on Tuesday October 11, 2011 @08:39AM (#3098290)
I have no particular affection for semicolons. But I do rather like braces - Python is ugly without them.
Re:Dart language by michaelchisari on Monday October 10, 2011 @04:37AM (#3092876)
I've been convinced of "less typing means less bugs", so I prefer no brackets, no semicolons, short reserved words, etc.
Re:Dart language by masklinn on Monday October 10, 2011 @04:21AM (#3092809)
> The language isn't done yet. Now is the time to let us know if you want semicolons to go away.

Seeing how Go, which "wasn't done yet" either, handled external feedback... I don't see why anyone would have hopes for dart.

Re:Dart language by munificent on Monday October 10, 2011 @04:24AM (#3092820)
I've been very pleasantly surprised at how open to feedback Lars, Kasper, and the gang have been with Dart. One of my big concerns joining the team was that it would be like Go which seems like a locked castle. So far, it's been much better than I expected.
Re:Dart language by 4ad on Monday October 10, 2011 @05:06AM (#3092964)
Look at how C++ handled external feedback and what it became because of this.
Re:Dart language by masklinn on Monday October 10, 2011 @08:20AM (#3093447)
There's kind-of a gap between accepting all external feedback (C++) and dismissing all of it (Go) don't you think?
Re:Dart language by SteveMcQwark on Monday October 10, 2011 @04:13PM (#3095590)
The Go team has actually reacted to a lot of feedback. They just haven't made sweeping changes to the language willy nilly at request.
Re:Dart language by nailer on Monday October 10, 2011 @08:12AM (#3093414)
Personally I don't even have the tolerance for braces. You're already indicating blocks via indentation.

- Requiring a redundant mechanism to mark blocks

- Possible introducing situations where code looks differently than how it executes

is all very mid-90s. python was the first to fix this, but yaml and coffescript do to. In particular, Dart will have to compete with mindshare from .coffee, so at least should be better than that.

Re:Dart language by WayneDB on Monday October 10, 2011 @12:27PM (#3094481)
Yeah, but with significant whitespace you create problems like "spaces vs tabs". I like semi-colons for the same reason that I prefer statically typed languages - exactness.
Re:Dart language by nailer on Monday October 10, 2011 @01:55PM (#3094943)
Sure but when I hack python (which is a lot, as it's my day job), I rarely encounter this (YMMV of course). It seems everyone knows not to use tabs in most languages, python is no exception.
Re:Dart language by akavlie on Monday October 10, 2011 @04:10AM (#3092758)
I want the semicolons to go away. Braces too.
Re:Dart language by georgemcbay on Monday October 10, 2011 @05:01AM (#3092952)
Where's the best place to lodge our complaints?

I'm fine with the semicolons, but I'm not too keen on using underscore-starting identifiers to determine what is public and what is private.

Re:Dart language by munificent on Monday October 10, 2011 @05:38AM (#3093037)
The misc mailing list is the (strangely named) main one: https://groups.google.com/a/dartlang.org/group/misc/topics. Join and fire away.

> I'm not too keen on using underscore-starting identifiers to determine what is public and what is private.

That's also been discussed. It has more going for it than may be at first apparent, but it has detractors too.

Re:Dart language by stephenhandley on Monday October 10, 2011 @08:40AM (#3093501)
_ for enforcing encapsulation is great, probably the one thing I've seen in dart that's exciting. simple way of giving an existing naming convention significance and cutting down on character overhead. i could see a whole line of languages expand on this idea.
Re:Dart language by dissident on Monday October 10, 2011 @05:14AM (#3092988)
The homepage links to this: http://www.dartlang.org/support/index.html.
Re:Dart language by nathanwdavis on Monday October 10, 2011 @10:54AM (#3094007)
Please allow type inference wherever possible:

I shouldn't need to write 'Point p = new Point(2, 3);'

var p = new Point(2,3); should be inferred as a Point

Re:Dart language by clownz0r on Monday October 10, 2011 @04:06AM (#3092741)
I prefer languages without semicolons, but, for me, semicolons aren't a dealbreaker.
Re:Dart language by maaku on Monday October 10, 2011 @04:09AM (#3092756)
they should not be mandatory
Re:Dart language by masklinn on Monday October 10, 2011 @04:22AM (#3092814)
If they're not mandatory, they should be out altogether unless required. Making them just optional is a path straight to js-land weird edge cases.
Re:Dart language by munificent on Monday October 10, 2011 @04:32AM (#3092859)
That's not true. Go, Python, Ruby and Scala all have optional semicolons without insanity. It's just that JavaScript's specific semantics for semicolon insertion (instead of newline elision!) are batshit crazy.
Re:Dart language by masklinn on Monday October 10, 2011 @04:50AM (#3092912)
> That's not true. Go, Python, Ruby and Scala all have optional semicolons without insanity.

Python (and Haskell) solve that issue by not using semicolons unless required. The Dart code in the examples is full of semicolons, that makes it an "optional semicolons language" akin to javascript more than a "possible semicolons language" akin to Python or Ruby.

Re:Dart language by munificent on Monday October 10, 2011 @07:05AM (#3093224)
> The Dart code in the examples is full of semicolons, that makes it an "optional semicolons language"

Well of course they do because semicolons are currently required, but that says nothing about its relationship to JavaScript's inane semicolon insertion semantics, and I'm pretty sure you're smart enough to know that. All Dart needs to do is:

1. Treat both newlines and semicolons as the same kind of token (call it whichever you like). 2. Pick an elision strategy. Go's or Python's work fine. 3. Remove all of the ";" from your source files.

No crazy JavaScript "rewind the parse and try again" insanity.

Re:Dart language by jmesserly on Monday October 10, 2011 @04:45AM (#3092896)
And pretty much all functional languages get by just fine without semicolons (Lisp, ML, Haskell, etc).
Re:Dart language by ErikCorry on Monday October 10, 2011 @06:24AM (#3093133)
ML uses semicolons.
Re:Dart language by dherman on Monday October 10, 2011 @09:30PM (#3096669)
I use semicolons pretty heavily in Lisp. ;)
Re:Dart language by dherman on Monday October 10, 2011 @11:46PM (#3097005)
Haskell has curly braces and semicolons.
Re:Dart language by roel_v on Monday October 10, 2011 @03:57AM (#3092713)
To be honest though, small syntactical differences like that are something that is meaningful only for novice-to-intermediate level programmers. Semicolons, braces, tabs-vs-spaces - classical examples of bikeshed bickering.
Re:Dart language by rue on Monday October 10, 2011 @04:04AM (#3092735)
No, they're not – nor is tabs-vs-spaces (convention) in the same category as semicolons (syntax). It's ergonomics; less superfluous entities and boilerplate makes it easier to express ideas.
Re:Dart language by epicureanideal on Monday October 10, 2011 @05:12AM (#3092981)
I have actually been noticing that I seem to prefer semicolons and braces in my code. I wonder if something about them makes it easier for my eyes/brain to delimit the content on the screen. Perhaps the "easy context-free-grammar parseable" code is easier on the brain than "hard context-free-grammar parseable" code. Having written a CFG for a Python dialect for one of the classes I took, it was a little tricky the first time doing it. Sure, it's not rocket science, but the fact that the semicolon is easier to implement may have some connection with easier identification of delimition on the screen.
Re:Dart language by roel_v on Monday October 10, 2011 @05:14AM (#3092986)
Awesome, your comment is a perfect epitome of the point I was making :) Convention/syntax is completely orthogonal to that point - that point being that experienced programmers don't notice the semicolons, or braces vs 'End If' (OK I realize I'm threading on thin ice with that one...) - once one reaches a certain fluency in programming and reading code, one transcends minute details like that.

It's like learning how to read, or learning how to read a new script. At first, you focus on the letters, composing words or sentences. When you get more experience, you read ever-larger blocks of text at once and you no longer need to read aloud or read aloud in your head, you can read whole lines or several lines at once and immediately transfer the concepts embodied in them into your mind (this is effectively how people read - chunks of text at a time, it's also why it's easy to read text where the letters of all words are mingled except the first and last one, a feat that is impossible when reading letter by letter or even word by word).

Anyway, in reading/writing code it's the same - at some point you no longer see a line with statements, you see a block with initializations, or no longer a set of if/then or switch statement, you see a jump table. Once you get to that level, dollar signs to denote variables disappear from the mental model you have, because you no longer see tokens - you see variables (same with semicolons, braces, most indentation, etc.). That's where the comparison came from.

(I also think that that's where eloquent code comes from - it's from programmers who make an efficient and recognizable translation from high-level concepts into the mechanics of the programming language, even if there is no explicit support for such concepts in the language).

Re:Dart language by mnemonicsloth on Monday October 10, 2011 @05:54AM (#3093062)
I am such an expert at reading English that I no longer think in terms of individual letters. Instead I think in words, phrases, concepts, and lines of argument.

But a crappy typeface or color scheme can still give me a headache.

Re:Dart language by Volpe on Monday October 10, 2011 @05:35AM (#3093031)
Bullshit elitist crap.

No one can argue with you because you just claim knowledge superiority that can't be confirmed or denied.

People care about this stuff, I don't care if you don't, if other people do, then it's an issue.

Re:Dart language by thy on Monday October 10, 2011 @09:43AM (#3093714)
i prefer semi colons too. i know its annoying when you write a piece of code, then you go test it. then an error occurs, then you go look for it, and finds out that theres missing an ;

besides that, its really easier to read the code with semi colon, when you get used to it.

also.. flash got optional ;

Re:Dart language by perlgeek on Monday October 10, 2011 @05:14AM (#3092989)
Which languages? javascript and go are both counter examples. In Go the lexer (sic) determines where a line ends, so if you write

    if (a == b)
        && (c == d) 
it will guess a line end after the first closing paren. WTF?

Python is a totally different beast, and I wouldn't include it in the discussion, because it also uses whitespace for block grouping.

Re:Dart language by enneff on Monday October 10, 2011 @06:04PM (#3096079)
There's no guesswork involved. The carriage return implies a semicolon. The rule is very simple and obvious in use (to me, the code you posted looks wrong - and it is).

http://golang.org/doc/go_spec.html#Semicolons

Re:Dart language by ch0wn on Monday October 10, 2011 @03:39AM (#3092663)
This was my first thought, as well. Looks like I will still go with another layer on top like CoffeeScript to actually write my scripts. Curly braces for blocks are something I don't see the need for anymore, either.
Re:Dart language by dave1010uk on Monday October 10, 2011 @03:56AM (#3092708)
Does having semicolons help with minification (which is common practice for sending JavaScript over the web)? Although, thinking about it, replacing ";" with "\n" would be the same number of bytes.

The only (contrived) advantage of using semicolons that I can think of is to avoid potential problems with line wrapping. For example, some mail clients add new lines after 80 characters, which would be more likely to break Dart code than JavaScript.