7 ms·
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 se
by timclark 15y ago
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.
- ch0wn 15y agoThis 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.
- munificent 15y agoThe 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.
- clownz0r 15y agoI prefer languages without semicolons, but, for me, semicolons aren't a dealbreaker.
- maaku 15y agothey should not be mandatory
- masklinn 15y agoIf 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.
- munificent 15y agoThat'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.
- jmesserly 15y agoAnd pretty much all functional languages get by just fine without semicolons (Lisp, ML, Haskell, etc).
- masklinn 15y ago> 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.
- munificent 15y ago> 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.
- akavlie 15y agoI want the semicolons to go away. Braces too.
- edanm 15y agoI 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.
- secoif 15y agoProgrammers 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.
- surrealize 15y agoFor human readers we use periods, not line breaks.
- secoif 15y agoThe context is programming, not writing.
- sambeau 15y agoCode is more like poetry.
- sambeau 15y agoThat 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.
- danmaz74 15y agoI'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
- clownz0r 15y agoYou raise a good point. I'd like to see more about testing Dart.
- munificent 15y agoWe 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
- clownz0r 15y agoThanks! I will take a look at these.
- munificent 15y agoI 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.
- masklinn 15y ago> 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.
- munificent 15y agoI'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.
- 4ad 15y agoLook at how C++ handled external feedback and what it became because of this.
- masklinn 15y agoThere's kind-of a gap between accepting all external feedback (C++) and dismissing all of it (Go) don't you think?
- SteveMcQwark 15y agoThe Go team has actually reacted to a lot of feedback. They just haven't made sweeping changes to the language willy nilly at request.
- lisperforlife 15y agoYes please. No semicolons. And please make it look a lot more like CoffeeScript than Java.
- johnx123-up 15y agoAm I in the minority? I madly in love with braces and semicolons. And, madly hate Pascal, Python & Ruby for the absence of them.
- deleted 15y ago[deleted]
- ajanuary 15y agoI have no particular affection for semicolons. But I do rather like braces - Python is ugly without them.
- michaelchisari 15y agoI've been convinced of "less typing means less bugs", so I prefer no brackets, no semicolons, short reserved words, etc.
- secoif 15y agoIn 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.
- secoif 15y agoAlso +1 for ability to extend the language itself so we can code in DSLs. This is so powerful.
- georgemcbay 15y agoWhere'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.
- dissident 15y agoThe homepage links to this: http://www.dartlang.org/support/index.html http://www.dartlang.org/support/index.html.
- munificent 15y agoThe misc mailing list is the (strangely named) main one: https://groups.google.com/a/dartlang.org/group/misc/topics 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.
- stephenhandley 15y ago_ 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.
- jules 15y agoPlease 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.
- nailer 15y agoPersonally 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.
- WayneDB 15y agoYeah, 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.
- nailer 15y agoSure 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.
- arctangent 15y agoPlease 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.
- nasmorn 15y agoAre 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.
- velagale 15y ago"Java" ugly ? Please name some beautiful languages.
- tjgillies 15y agoRuby
- nathanwdavis 15y agoPlease 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
- dave1010uk 15y agoDoes 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.
- roel_v 15y agoTo 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.
- rue 15y agoNo, 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.
- epicureanideal 15y agoI 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.
- roel_v 15y agoAwesome, 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).
- perlgeek 15y agoWhich 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.
- enneff 15y agoThere'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 http://golang.org/doc/go_spec.html#Semicolons
- deleted 15y ago[deleted]