Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional line terminating semi colons #4461

Closed
DartBot opened this issue Aug 12, 2012 · 5 comments
Closed

Optional line terminating semi colons #4461

DartBot opened this issue Aug 12, 2012 · 5 comments
Labels
closed-duplicate Closed in favor of an existing report

Comments

@DartBot
Copy link

DartBot commented Aug 12, 2012

This issue was originally filed by demis.b...@gmail.com


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.

Mandatory semi colons just adds un-necessary line-noise making the code uglier and less fun.

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 :)

@DartBot
Copy link
Author

DartBot commented Aug 12, 2012

This comment was originally written by kaisellgren@gmail.com


I really like the fact that we have this "Dart Style Guide" that we should all follow, this keeps the community projects consistent and consistency is a major plus at least to me.

Now if semicolons were made optional, and every other project used them while the rest did not, we would end up in inconsistency. What would Dart Style Guide prefer -- semicolons or no semicolons? People would follow the guide and when they do, the last point of your issue no longer holds true:

"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 :)"

If semicolons were to disappear, I hope they are gone completely, rather than a mixed up situation which in my opinion turns into mess.

@DartBot
Copy link
Author

DartBot commented Aug 12, 2012

This comment was originally written by ladicek@gmail.com


IIUC, this is a duplicate of issue #34.

@sethladd
Copy link
Contributor

Added Duplicate label.
Marked as being merged into #34.

@DartBot
Copy link
Author

DartBot commented May 19, 2013

This comment was originally written by Mortdeu...@gocos2d.org


As somebody who has been using nothing but Go for the last year, Dart really should implement this feature because its a real annoyance for developers like myself who are used to not having to type semicolons. We write a bunch of code and then end up having to go back and insert the semicolons when our builds fail.

In Go the implementation of optional semicolons is trivial and if dart ever gets a go fmt like tool (which it should.) users can set their preference. The only thing that you give up is that you have to use the C style of scope blocks.

For example,
int foo(){
   return bar()
}
vs
int foo() //this doesnt work because \n is interpreted as a ; unless it sees {
{
   return bar()
}
A small price to pay now for something thats going to be a HUGE nuance for many web developers. (there are many python, ruby, go devs to think about too!)

@DartBot
Copy link
Author

DartBot commented May 20, 2013

This comment was originally written by ts...@gmail.com


I vote against optional semi-colons. It seems to me that a lot of effort has been put into describing the correct way to format code (i.e., the Dart style guide) and allowing a feature like semi-colon line termination to be optional would break consistency across code.

I also vote against removing line-terminating-semi-colons. Trust me when I say that I understand the frustration; I've been working with languages like C++ and Java for a long time and forgetting that stupid semi-colon can be very frustrating. However, I believe that the clarity it gives code makes it more than worthwhile. There is no confusion as to when a statement begins and when it ends, even if it has to cross line boundaries. I commonly see code confusion in languages that don't require the semi-colon due to questions regarding statement positioning and I'd like to avoid that if at all possible.

I know that code can certainly work without requiring the semi-colons, I just don't think that the advantages outweigh the disadvantages.

@DartBot DartBot added Type-Defect closed-duplicate Closed in favor of an existing report labels May 20, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

2 participants