Matt
No, it's easy.
For each state of the grammar, the parser need to disable the lexer automaton that will generate an error
if the token is recognized by the lexer. (see http://weblogs.java.net/blog/forax/archive/paper.pdf)
So now, the lexer will fail fast saying that no automaton match at the end of an instruction,
in that case, the lexer can ask the parser the current state and see if there is a transition
use semicolon that doesn't lead to an error. If it's true, the semicolon is inserted.
We have decided not to support optional semicolons for the following reasons: - White space should not have semantic impact. In JavaScript the worst problem related to this is around return. return 1 This will return undefined which is completely broken. - Dart programs will be become more consistent and therefore easier to read.
--
Ok,
the other possible semantics is to insert a semicolon instead of a newline
if it creates a valid statement without taking care of the following tokens.
At least, this rule is far easier to understand that the ASI rules.
RĆÆĀæĀ½mi
On 08/13/2012 11:20 AM, Lasse R.H. Nielsen wrote:
-- Ryan (ć©ć¤ć¢ć³) Yoko Shimomura, ryo (supercell/EGOIST), Hiroyuki Sawano >> everyone else https://refi64.com/
--
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+uns...@dartlang.org.
'We' ' do ' 'have' ' adjacent string literals:' 'Let\'s spot the error'.Ā
Hard pass on optional semicolons. Just no. One of the things that I love about Dart is that it is opinionated and has an awesome style guide and formatter. I don't want to go back to nitpicks on code reviews about whether you should or shouldn't use semi-colons (or tabs, or braces, or etc...)
On Sunday, August 12, 2012 at 2:17:31 AM UTC-6, mythz wrote:This has been brought up a few times so I thought it would be a good idea to have this written down somewhere so we can measure demand for it.So devs who want this feature can star the issue here:The case for optional semi colons is obvious:ĀMandatory semi colons just adds un-necessary line-noise making the code uglier and less fun.It would be nice if Dart followed all the modern C-like languages i.e. Scala, Go, Kotlin and not require end-of-line semi colons.ĀIt's actually rare to require them considering most functional, scheme-like, scripting & dynamic langs avoid them as well. I understand Dart is meant to appeal to C# / Java devs, but they would still be able to optionally add end of lines semi-colon if it makes them more comfortable - whilst the rest of us can write prettier code :)Normally I wouldn't suggest this, but since even modern C-like languages are able to get by without them, I don't expect them to be too disruptive to implement.
--
KDawg <kevin...@gmail.com> writes:
> Lack of an end-of-statement terminator is a horrible idea. Case in point,
> consider Kotlin:
>
> var x = 1 + 1 + 1
> println(x)
>
> results in 3, whereas
>
> var x = 1 + 1
> + 1
> println(x)
>
> results in 2.
I think that's just bad style.Ā This parses properly, in Kotlin, JS,
Ruby, and Go:
Ā Ā var x = 1 + 1 +
Ā Ā 1
Ā Ā println(x)
If only everyone was as enthusiastic about removing nulls as removing semicolons!Ā š
There may be a way to make everybody happy here.Remove all semicolons, and have an option to see them in the editor (without them being really there).I picture this similarly as how Flutter shows the end of a Widget by a comment that is not really there.That being said, semicolons are just noise, they decrease readability, liking them is like a bad habit. In the beginning you crave it, but after a while life is actually easier when you quit.
If only everyone was as enthusiastic about removing nulls as removing semicolons!Ā š
Presumably the next step is removing braces and being whitespace-sensitive? No? :(
If only everyone was as enthusiastic about removing nulls as removing semicolons!Ā šI think most people are moreĀ enthusiastic about removing nulls. :) But it's also a muchĀ more complex feature to ship.
Presumably the next step is removing braces and being whitespace-sensitive? No? :(No, definitely not. I could write an essay about this but the short summary is that significant indentation works OK for Python but pushes you towards a statement-oriented mindset. This is why, for example, lambdas can only contain a single expression, not statements in Python. You canĀ do significant indentation in an expression-oriented language ā Haskell does ā but it's weird and quirky.Dart is not at all as statement-focused as Python. Idiomatic Dart code often contains lambdas (expressions) containing block bodies (statements) containing other lambdas (expressions) containing block bodies (statements). That kind of interleaving gets mega-weird if you try to use indentation for blocks.Curly brace blocks work really well, I think. It's useful to have an explicit terminator for a region of code and "}" does that.
--