www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - consequences of removing semicolons in D like in Python

reply eugene <egordeev18 gmail.com> writes:
Hello everyone,
what if to remove semicolons at the end of each line of code in D 
like in Python?
Is it worth it?
Sep 16 2016
next sibling parent reply eugene <egordeev18 gmail.com> writes:
On Friday, 16 September 2016 at 23:00:08 UTC, eugene wrote:
 Hello everyone,
 what if to remove semicolons at the end of each line of code in 
 D like in Python?
 Is it worth it?
i.e. simply use a newline sign as a line separator
Sep 16 2016
parent reply Chris M. <chrismohrfeld comcast.net> writes:
On Friday, 16 September 2016 at 23:01:32 UTC, eugene wrote:
 On Friday, 16 September 2016 at 23:00:08 UTC, eugene wrote:
 Hello everyone,
 what if to remove semicolons at the end of each line of code 
 in D like in Python?
 Is it worth it?
i.e. simply use a newline sign as a line separator
Pointless and not worth breaking everyone's code over
Sep 16 2016
next sibling parent reply eugene <egordeev18 gmail.com> writes:
On Saturday, 17 September 2016 at 02:21:54 UTC, Chris M. wrote:
 Pointless and not worth breaking everyone's code over
why?
Sep 17 2016
parent reply Jonathan M Davis via Digitalmars-d <digitalmars-d puremagic.com> writes:
On Saturday, September 17, 2016 10:15:57 eugene via Digitalmars-d wrote:
 On Saturday, 17 September 2016 at 02:21:54 UTC, Chris M. wrote:
 Pointless and not worth breaking everyone's code over
why?
Having semicolons actually serves as a synchronization point for the compiler, which helps it give better error messages. Sure, trying to use newlines that way can work, but it's more problematic - especially when you take stuff like multiline statements into account. D - like C/C++/Java/C# - is not whitespace sensitive, and like those languages, it uses semicolons. There really is no technical reason why getting rid of semicolons improves things, and it does make them at least slightly worse as far as the compiler goes. It's just cleaner to have semicolons, and most D programmers have no problem with that - even prefer it. In addition, needlessly altering D's syntax like that would make porting C/C++ code to it much harder, which would be a significant problem for a decent chunk of our user base. D's syntax tends to stick with C/C++'s syntax unless it has a compelling reason to do otherwise. And regardless of whether not having semicolons would be better or not, it would be a huge breaking change to get rid of them, which isn't even vaguely worth it. Sure, D continues to involve, but it's reasonably stable, and we want it to become _more_ stable, not less. It's _way_ past the point that we would consider making a change like this. Doing something like removing semicolons from the language would alienate a huge portion of our user base. Most would consider the change to be objectively worse, and even if they didn't care about whether D had semicolons or not, they would _not_ be pleased to have their code break. - Jonathan M Davis
Sep 17 2016
parent reply cym13 <cpicard openmailbox.org> writes:
On Saturday, 17 September 2016 at 11:03:14 UTC, Jonathan M Davis 
wrote:
 On Saturday, September 17, 2016 10:15:57 eugene via 
 Digitalmars-d wrote:
 On Saturday, 17 September 2016 at 02:21:54 UTC, Chris M. wrote:
 Pointless and not worth breaking everyone's code over
why?
Having semicolons actually serves as a synchronization point for the compiler, which helps it give better error messages. Sure, trying to use newlines that way can work, but it's more problematic - especially when you take stuff like multiline statements into account. D - like C/C++/Java/C# - is not whitespace sensitive, and like those languages, it uses semicolons. There really is no technical reason why getting rid of semicolons improves things, and it does make them at least slightly worse as far as the compiler goes. It's just cleaner to have semicolons, and most D programmers have no problem with that - even prefer it.
There are also language constructs with semicolons inside, I'm not sure it would add that much complexity, but there are some cases that would be ambiguous: void filterEven() { print("Nothing here") } auto filterEven(int[] arr) { import std.algorithm : filter return arr.filter!(x => x%2) } void main() { auto i = [1, 2, 3] .filterEven() } Note how a leading dot means “global scope” but a dot after something means UFCS or method/attribute. What should this program do? If it is akin to “auto i = [1, 2, 3]; .filterEven();” then i is an int[] and the program prints “Nothing here”. But if it is understood as “auto i = [1, 2, 3].filterEven();” then i is whatever type filter returned and nothing is printed.
 In addition, needlessly altering D's syntax like that would 
 make porting C/C++ code to it much harder, which would be a 
 significant problem for a decent chunk of our user base. D's 
 syntax tends to stick with C/C++'s syntax unless it has a 
 compelling reason to do otherwise.
That's the really good reason. Semicolons are a cultural choice more than a technical one but once we've made that choice there's no turning back without loosing nearly all users. Besides the ability to port code easily from one language to another is important. I have in mind this recent article “Why I'm dropping Rust” (https://hackernoon.com/why-im-dropping-rust-fd1c32986c88). The author tried to port a C++ library but as language constructs are different he wasn't able to do so without having to rethink the architecture from scratch. We want it to be easy to port any project to D.
 And regardless of whether not having semicolons would be better 
 or not, it would be a huge breaking change to get rid of them, 
 which isn't even vaguely worth it. Sure, D continues to 
 involve, but it's reasonably stable, and we want it to become 
 _more_ stable, not less. It's _way_ past the point that we 
 would consider making a change like this. Doing something like 
 removing semicolons from the language would alienate a huge 
 portion of our user base. Most would consider the change to be 
 objectively worse, and even if they didn't care about whether D 
 had semicolons or not, they would _not_ be pleased to have 
 their code break.

 - Jonathan M Davis
Sep 17 2016
parent ixid <adamsibson gmail.com> writes:
On Saturday, 17 September 2016 at 11:59:53 UTC, cym13 wrote:
 Note how a leading dot means “global scope” but a dot after 
 something means UFCS or method/attribute. What should this 
 program do? If it is akin to “auto i = [1, 2, 3]; 
 .filterEven();” then i is an int[] and the program prints 
 “Nothing here”. But if it is understood as “auto i = [1, 2, 
 3].filterEven();” then i is whatever type filter returned and 
 nothing is printed.
Entirely aside from removing semi-colons or not the global dot operator needs to be killed with fire and replaced with something more explicit. It's far too rarely used to justify such an easily confused and meaningless grammar.
Sep 17 2016
prev sibling parent reply jmh530 <john.michael.hall gmail.com> writes:
On Saturday, 17 September 2016 at 02:21:54 UTC, Chris M. wrote:
 On Friday, 16 September 2016 at 23:01:32 UTC, eugene wrote:
 On Friday, 16 September 2016 at 23:00:08 UTC, eugene wrote:
 Hello everyone,
 what if to remove semicolons at the end of each line of code 
 in D like in Python?
 Is it worth it?
i.e. simply use a newline sign as a line separator
Pointless and not worth breaking everyone's code over
What if the OP wrote a compiler that turned his version of D sans semicolons into proper D code?
Sep 17 2016
next sibling parent reply Chris Wright <dhasenan gmail.com> writes:
On Sat, 17 Sep 2016 14:23:40 +0000, jmh530 wrote:

 On Saturday, 17 September 2016 at 02:21:54 UTC, Chris M. wrote:
 On Friday, 16 September 2016 at 23:01:32 UTC, eugene wrote:
 On Friday, 16 September 2016 at 23:00:08 UTC, eugene wrote:
 Hello everyone,
 what if to remove semicolons at the end of each line of code in D
 like in Python?
 Is it worth it?
i.e. simply use a newline sign as a line separator
Pointless and not worth breaking everyone's code over
What if the OP wrote a compiler that turned his version of D sans semicolons into proper D code?
Someone did that with python-style syntax a while back, in the D1 days, though I forget the name of it. Multiple syntaxes for the same language is kind of cool.
Sep 17 2016
parent =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 09/17/2016 07:32 AM, Chris Wright wrote:

 python-style syntax a while back, in the D1 days,
 though I forget the name of it.
http://delight.sourceforge.net/ Ali
Sep 19 2016
prev sibling parent reply eugene <egordeev18 gmail.com> writes:
On Saturday, 17 September 2016 at 14:23:40 UTC, jmh530 wrote:
 What if the OP wrote a compiler that turned his version of D 
 sans semicolons into proper D code?
i didn't try to implement it myself, but i will try
Sep 17 2016
parent Kagamin <spam here.lot> writes:
On Saturday, 17 September 2016 at 14:47:38 UTC, eugene wrote:
 On Saturday, 17 September 2016 at 14:23:40 UTC, jmh530 wrote:
 What if the OP wrote a compiler that turned his version of D 
 sans semicolons into proper D code?
i didn't try to implement it myself, but i will try
There's already a compiler: http://delight.sourceforge.net/
Sep 19 2016
prev sibling next sibling parent rikki cattermole <rikki cattermole.co.nz> writes:
On 17/09/2016 11:00 AM, eugene wrote:
 Hello everyone,
 what if to remove semicolons at the end of each line of code in D like
 in Python?
 Is it worth it?
Also lua would be a better example as it allows for with and without.
Sep 16 2016
prev sibling next sibling parent reply Chris Wright <dhasenan gmail.com> writes:
On Fri, 16 Sep 2016 23:00:08 +0000, eugene wrote:

 Hello everyone,
 what if to remove semicolons at the end of each line of code in D like
 in Python?
 Is it worth it?
It's more than reinterpreting newline as a semicolon. For instance, we'd probably still want this to work: someObject.someField.someLongMethodName( arg1, arg2, arg3); You might look into how javascript does it and what weirdness ensues as a result.
Sep 16 2016
next sibling parent tcak <1ltkrs+3wyh1ow7kzn1k sharklasers.com> writes:
On Saturday, 17 September 2016 at 05:03:17 UTC, Chris Wright 
wrote:
 On Fri, 16 Sep 2016 23:00:08 +0000, eugene wrote:

 Hello everyone,
 what if to remove semicolons at the end of each line of code 
 in D like
 in Python?
 Is it worth it?
It's more than reinterpreting newline as a semicolon. For instance, we'd probably still want this to work: someObject.someField.someLongMethodName( arg1, arg2, arg3); You might look into how javascript does it and what weirdness ensues as a result.
Yup. Every time I write multiline expression in JS, I get uncomfortable thinking whether the browser will interpret as I think or not.
Sep 17 2016
prev sibling parent reply Sebastiaan Koppe <mail skoppe.eu> writes:
On Saturday, 17 September 2016 at 05:03:17 UTC, Chris Wright 
wrote:
 someObject.someField.someLongMethodName(
   arg1,
   arg2,
   arg3);
There are no semicolons in an ArgumentList.
 You might look into how javascript does it and what weirdness 
 ensues as a result.
Its weird and uncomfortable at first, but there are only a handful of characters that cause multiple lines to be interpreted as one. Characters like [, (, +, - and ` (es6) Where it gets a little bit weird is with return statements for instance, since there can be no newline before the expression to be returned. Arrow functions, while statements, etc. have similar constraints. All pretty obvious once you know the rules. That is pretty much it. Having said all that, I do think a much better solution to avoid the visual clutter is to make the semicolon transparent in the syntax highlighting.
Sep 17 2016
parent Chris Wright <dhasenan gmail.com> writes:
On Sat, 17 Sep 2016 09:09:44 +0000, Sebastiaan Koppe wrote:

 On Saturday, 17 September 2016 at 05:03:17 UTC, Chris Wright wrote:
 someObject.someField.someLongMethodName(
   arg1, arg2, arg3);
There are no semicolons in an ArgumentList.
Thank you for repeating my point, that you have to look at the grammar to see where a semicolon could appear and not just insert a semicolon at every newline.
 You might look into how javascript does it and what weirdness ensues as
 a result.
[...] Where it gets a little bit weird is with return statements for instance, since there can be no newline before the expression to be returned. Arrow functions, while statements, etc. have similar constraints. All pretty obvious once you know the rules. That is pretty much it.
Sounds reasonable. So it's not likely to be a huge problem except for existing code.
 Having said all that, I do think a much better solution to avoid the
 visual clutter is to make the semicolon transparent in the syntax
 highlighting.
That's okay for reading code that you know compiles, not so great for writing code that might have a missing semicolon.
Sep 17 2016
prev sibling next sibling parent Bastiaan Veelo <Bastiaan Veelo.net> writes:
On Friday, 16 September 2016 at 23:00:08 UTC, eugene wrote:
 Is it worth it?
This has been discussed at length in 2009. TLDR: It's not worth it. http://forum.dlang.org/post/hbo0h2$2ksb$1 digitalmars.com
Sep 17 2016
prev sibling next sibling parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 09/16/2016 07:00 PM, eugene wrote:
 Hello everyone,
 what if to remove semicolons at the end of each line of code in D like
 in Python?
 Is it worth it?
Not worth it. Gripes about semicolons are a symptom of only seeing the superficial and not really understanding enough about languages to see what really is and isn't important. It's like dumping someone because you don't like the color of a dress they wore. Superficial, shallow, inconsequential bikeshed bullcrap, not even worth debating.
Sep 17 2016
parent reply eugene <egordeev18 gmail.com> writes:
On Saturday, 17 September 2016 at 13:11:50 UTC, Nick Sabalausky 
wrote:
 On 09/16/2016 07:00 PM, eugene wrote:
 Hello everyone,
 what if to remove semicolons at the end of each line of code 
 in D like
 in Python?
 Is it worth it?
Not worth it. Gripes about semicolons are a symptom of only seeing the superficial and not really understanding enough about languages to see what really is and isn't important. It's like dumping someone because you don't like the color of a dress they wore. Superficial, shallow, inconsequential bikeshed bullcrap, not even worth debating.
why? groovy, for e.g., is ok without semicolons and with semicolons. if there is a question of backward compatibility, is it possible to support semicolons?
Sep 17 2016
parent reply Craig Dillabaugh <craig.dillabaugh gmail.com> writes:
On Saturday, 17 September 2016 at 13:18:24 UTC, eugene wrote:
 On Saturday, 17 September 2016 at 13:11:50 UTC, Nick Sabalausky 
 wrote:
 On 09/16/2016 07:00 PM, eugene wrote:
 Hello everyone,
 what if to remove semicolons at the end of each line of code 
 in D like
 in Python?
 Is it worth it?
Not worth it. Gripes about semicolons are a symptom of only seeing the superficial and not really understanding enough about languages to see what really is and isn't important. It's like dumping someone because you don't like the color of a dress they wore. Superficial, shallow, inconsequential bikeshed bullcrap, not even worth debating.
why? groovy, for e.g., is ok without semicolons and with semicolons. if there is a question of backward compatibility, is it possible to support semicolons?
Can you give a strong technical argument why we should get rid of the semicolons? I personally quite like them, as do others, so I don't think "I don't like the looks of them" is a strong argument. What would the language gain by losing the semi-colons.
Sep 17 2016
parent reply eugene <egordeev18 gmail.com> writes:
On Saturday, 17 September 2016 at 13:33:49 UTC, Craig Dillabaugh 
wrote:
 On Saturday, 17 September 2016 at 13:18:24 UTC, eugene wrote:
 On Saturday, 17 September 2016 at 13:11:50 UTC, Nick 
 Sabalausky wrote:
 On 09/16/2016 07:00 PM, eugene wrote:
 Hello everyone,
 what if to remove semicolons at the end of each line of code 
 in D like
 in Python?
 Is it worth it?
Not worth it. Gripes about semicolons are a symptom of only seeing the superficial and not really understanding enough about languages to see what really is and isn't important. It's like dumping someone because you don't like the color of a dress they wore. Superficial, shallow, inconsequential bikeshed bullcrap, not even worth debating.
why? groovy, for e.g., is ok without semicolons and with semicolons. if there is a question of backward compatibility, is it possible to support semicolons?
Can you give a strong technical argument why we should get rid of the semicolons? I personally quite like them, as do others, so I don't think "I don't like the looks of them" is a strong argument. What would the language gain by losing the semi-colons.
because a programmer will have a choice of writing or not semicolons, as one anyway presses "Enter" why not to use it as a line separator, and one who likes to type semicolons won't be confused if there is backward compatibility
Sep 17 2016
parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 09/17/2016 09:38 AM, eugene wrote:
 because a programmer will have a choice of writing or not semicolons, as
 one anyway presses "Enter" why not to use it as a line separator, and
 one who likes to type semicolons won't be confused if there is backward
 compatibility
Other people have already explained the reasons. It all just comes down to one thing: There's a class of programmers who will never stop griping about trivialities like "Oh my god, I have to type a semicolon?! How horrible!" Can we drop the matter already and get back to something a little bit less worthless like tabs vs spaces. If semicolons are such a terrible drain, there's always JS and Python. Have fun.
Sep 17 2016
parent reply bpr <brogoff gmail.com> writes:
On Saturday, 17 September 2016 at 16:43:13 UTC, Nick Sabalausky 
wrote:
 If semicolons are such a terrible drain, there's always JS and 
 Python.
For someone who likes D, Nim (http://www.nim-lang.org) would be better a choice for a language at the same level with Python like syntax. Changing D surface syntax is an obvious non-starter.
Sep 19 2016
parent reply Chris <wendlec tcd.ie> writes:
On Monday, 19 September 2016 at 16:52:10 UTC, bpr wrote:
 On Saturday, 17 September 2016 at 16:43:13 UTC, Nick Sabalausky 
 wrote:
 If semicolons are such a terrible drain, there's always JS and 
 Python.
For someone who likes D, Nim (http://www.nim-lang.org) would be better a choice for a language at the same level with Python like syntax. Changing D surface syntax is an obvious non-starter.
Or Crystal https://crystal-lang.org/ It's Ruby syntax with some of the nice features you'd find in D. It's only alpha at the moment and doesn't work on Windows. The thing is that there is no way of telling how much D code would break (including the compiler), if semicolons were removed or optional. That's too big of a gamble for a purely aesthetic change.
Sep 19 2016
parent reply jmh530 <john.michael.hall gmail.com> writes:
On Monday, 19 September 2016 at 20:22:00 UTC, Chris wrote:
 The thing is that there is no way of telling how much D code 
 would break (including the compiler), if semicolons were 
 removed or optional. That's too big of a gamble for a purely 
 aesthetic change.
I don't see a reason to make that sort of change within the D language or DMD, especially when something like Delight exists and probably accomplishes exactly what the OP had wanted. It looks like the last commit was last year to bring it in line with 2.067 https://github.com/pplantinga/delight so if people are interested they could probably get in touch with the author of that and help get it updated.
Sep 19 2016
parent reply eugene <egordeev18 gmail.com> writes:
On Monday, 19 September 2016 at 20:42:22 UTC, jmh530 wrote:
 I don't see a reason to make that sort of change within the D 
 language or DMD, especially when something like Delight exists 
 and probably accomplishes exactly what the OP had wanted.
Delight is not what i meant, i meant something like this: module test import std.stdio void main() { write("Hello"); writeln("world") }
Sep 20 2016
parent reply bachmeier <no spam.net> writes:
On Tuesday, 20 September 2016 at 11:24:29 UTC, eugene wrote:
 On Monday, 19 September 2016 at 20:42:22 UTC, jmh530 wrote:
 I don't see a reason to make that sort of change within the D 
 language or DMD, especially when something like Delight exists 
 and probably accomplishes exactly what the OP had wanted.
Delight is not what i meant, i meant something like this: module test import std.stdio void main() { write("Hello"); writeln("world") }
Without the semicolons, I have to parse the code myself, which makes it harder to read. Do that with 1000 lines of code and it gives me a headache. I have written many tens of thousands of lines of R code and hate the lack of semicolons. This is purely a matter of preference.
Sep 20 2016
parent reply eugene <egordeev18 gmail.com> writes:
On Tuesday, 20 September 2016 at 12:00:00 UTC, bachmeier wrote:
 Without the semicolons, I have to parse the code myself
could you, please, explain, why do you parse code yourself?
Sep 20 2016
parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 09/20/2016 08:20 AM, eugene wrote:
 On Tuesday, 20 September 2016 at 12:00:00 UTC, bachmeier wrote:
 Without the semicolons, I have to parse the code myself
could you, please, explain, why do you parse code yourself?
That's what happens in the brain when you read code. He's not talking about actual LR/LL/etc parsing here, but the mental equivalent. Just like you parse a sentence when you read it by noticing the spaces defining where words are. And the commas separating sections of a sentence, and periods/capitalization separating the sentences, in-sentence capitalization signaling proper nouns, etc. All of those are *technically* unnecessary too, but notice how much harder it is to read (ie, "parse") when they're absent. thats what happens in the brain when you read code hes not talking about actual lr ll etc parsing here but the mental equivalent just like you parse a sentence when you read it by noticing the spaces defining where words are and the commas separating sections of a sentence and periods capitalization separating the sentences in sentence capitalization signaling proper nouns etc all of those are technically unnecessary too but notice how much harder it is to read ie parse when theyre absent
Sep 20 2016
parent reply eugene <egordeev18 gmail.com> writes:
On Tuesday, 20 September 2016 at 14:19:50 UTC, Nick Sabalausky 
wrote:
 Just like you parse a sentence when you read it by noticing the 
 spaces defining where words are. And the commas separating 
 sections of a sentence, and periods/capitalization separating 
 the sentences, in-sentence capitalization signaling proper 
 nouns, etc. All of those are *technically* unnecessary too, but 
 notice how much harder it is to read (ie, "parse") when they're 
 absent.
one doesn't parse a sentence when one reads it, one translates a sentence into images; why do you compare native speech sentences with a programming language statements? one doesn't parse a sentence when one reads it one translates a sentence into images why do you compare native speech sentences with a programming language statements
Sep 20 2016
parent reply Chris <wendlec tcd.ie> writes:
On Tuesday, 20 September 2016 at 15:07:31 UTC, eugene wrote:
 one doesn't parse a sentence when one reads it, one translates 
 a sentence into images; why do you compare native speech 
 sentences with a programming language statements?

 one doesn't parse a sentence when one reads it
 one translates a sentence into images
 why do you compare native speech sentences with a programming 
 language statements
Yes and no. Of course it's like an image (i.e. you see it), but commas, colons, fullstops etc. _help_ you to find your way around in the text and sometimes even help to disambiguate. You'll notice this in the comment section under newspaper articles: sometimes it's hard to understand a sentence at first reading, when people leave out commas where they would make sense. So you have to re-analyze the sentence. E.g.: "I was talking to Joan and Peter went to the shop to buy some sweets." vs. "I was talking to Joan, and Peter went to the shop to buy some sweets." I'm sure someone can find an example where a sentence would be ambiguous without proper punctuation. Anyway, why don't you grab the compiler and make a version that accepts line breaks and ";" - and see what happens?
Sep 20 2016
parent reply eugene <egordeev18 gmail.com> writes:
On Tuesday, 20 September 2016 at 15:28:51 UTC, Chris wrote:
 Anyway, why don't you grab the compiler and make a version that 
 accepts line breaks and ";" - and see what happens?
yes, i've written about it in the thread before
Sep 20 2016
parent reply Chris <wendlec tcd.ie> writes:
On Tuesday, 20 September 2016 at 15:31:21 UTC, eugene wrote:
 On Tuesday, 20 September 2016 at 15:28:51 UTC, Chris wrote:
 Anyway, why don't you grab the compiler and make a version 
 that accepts line breaks and ";" - and see what happens?
yes, i've written about it in the thread before
Then try to compile Phobos and a variety of D projects on Github and publish the results. It'd be interesting to see what problems you encounter. Then you might write a tool like dfix that fixes the source code so that ";"-less code is parsed properly etc. But is it really worth it?
Sep 20 2016
next sibling parent reply Chris <wendlec tcd.ie> writes:
On Tuesday, 20 September 2016 at 15:36:42 UTC, Chris wrote:
 On Tuesday, 20 September 2016 at 15:31:21 UTC, eugene wrote:
 On Tuesday, 20 September 2016 at 15:28:51 UTC, Chris wrote:
 Anyway, why don't you grab the compiler and make a version 
 that accepts line breaks and ";" - and see what happens?
yes, i've written about it in the thread before
Then try to compile Phobos and a variety of D projects on Github and publish the results. It'd be interesting to see what problems you encounter. Then you might write a tool like dfix that fixes the source code so that ";"-less code is parsed properly etc. But is it really worth it?
It'd be interesting, because it would finally provide data for the ever-recurring question of whether to have semicolons or not. ¿How would you handle cases like debug { writeln("Error"); return; } of just debug { writeln("Error"); }
Sep 20 2016
parent reply eugene <egordeev18 gmail.com> writes:
On Tuesday, 20 September 2016 at 15:42:10 UTC, Chris wrote:
 ¿How would you handle cases like

 debug { writeln("Error"); return; }

 of just

 debug { writeln("Error"); }
it is handled by separating each statement with newline, not semicolon
Sep 22 2016
parent reply Chris <wendlec tcd.ie> writes:
On Thursday, 22 September 2016 at 13:44:33 UTC, eugene wrote:
 On Tuesday, 20 September 2016 at 15:42:10 UTC, Chris wrote:
 ¿How would you handle cases like

 debug { writeln("Error"); return; }

 of just

 debug { writeln("Error"); }
it is handled by separating each statement with newline, not semicolon
What about braces and brackets? debug { writeln("Error") } Both `{...}` and `writeln("Error")` are clearly delimited.
Sep 22 2016
parent reply eugene <egordeev18 gmail.com> writes:
On Thursday, 22 September 2016 at 14:07:29 UTC, Chris wrote:
 What about braces and brackets?

 debug { writeln("Error") }
i think writeln("Error") could be parsed as one statement
Sep 22 2016
parent Chris <wendlec tcd.ie> writes:
On Thursday, 22 September 2016 at 14:36:31 UTC, eugene wrote:
 On Thursday, 22 September 2016 at 14:07:29 UTC, Chris wrote:
 What about braces and brackets?

 debug { writeln("Error") }
i think writeln("Error") could be parsed as one statement
I think so too, and `debug {}` too.
Sep 22 2016
prev sibling next sibling parent reply eugene <egordeev18 gmail.com> writes:
On Tuesday, 20 September 2016 at 15:36:42 UTC, Chris wrote:
 But is it really worth it?
this was my question at the beginning of the thread
Sep 20 2016
parent reply Chris <wendlec tcd.ie> writes:
On Tuesday, 20 September 2016 at 15:42:58 UTC, eugene wrote:
 On Tuesday, 20 September 2016 at 15:36:42 UTC, Chris wrote:
 But is it really worth it?
this was my question at the beginning of the thread
You come across as if you had set your heart on removing semicolons.
Sep 20 2016
parent reply eugene <egordeev18 gmail.com> writes:
On Tuesday, 20 September 2016 at 15:46:58 UTC, Chris wrote:
 You come across as if you had set your heart on removing 
 semicolons.
i didn't set my heart on removing semicolons, the topic is "consequences of removing semicolons..."
Sep 20 2016
parent Chris <wendlec tcd.ie> writes:
On Tuesday, 20 September 2016 at 15:53:20 UTC, eugene wrote:
 On Tuesday, 20 September 2016 at 15:46:58 UTC, Chris wrote:
 You come across as if you had set your heart on removing 
 semicolons.
i didn't set my heart on removing semicolons, the topic is "consequences of removing semicolons..."
There's only one way to find out :-) Nobody has ever done it before afaik.
Sep 20 2016
prev sibling parent jmh530 <john.michael.hall gmail.com> writes:
On Tuesday, 20 September 2016 at 15:36:42 UTC, Chris wrote:
 Then try to compile Phobos and a variety of D projects on 
 Github and publish the results. It'd be interesting to see what 
 problems you encounter. Then you might write a tool like dfix 
 that fixes the source code so that ";"-less code is parsed 
 properly etc. But is it really worth it?
If you look at the github page, it seems that it already has this ability, with some qualifications.
Sep 20 2016
prev sibling next sibling parent Lodovico Giaretta <lodovico giaretart.net> writes:
On Friday, 16 September 2016 at 23:00:08 UTC, eugene wrote:
 Hello everyone,
 what if to remove semicolons at the end of each line of code in 
 D like in Python?
 Is it worth it?
Another reason not listed in previous answers (or I didn't see it) is that D as a unique (AFAIK) capability: string mixins. If the language were whitespace-sensitive (as Python is), writing string mixins would be a lot more painful, as it is very difficult and unconvenient to write the mixed-in strings with correct indentation and line breaks. Having explicit delimiters (both semicolons and curly braces) is very important for the usability of this feature.
Sep 17 2016
prev sibling parent reply pineapple <meapineapple gmail.com> writes:
On Friday, 16 September 2016 at 23:00:08 UTC, eugene wrote:
 Hello everyone,
 what if to remove semicolons at the end of each line of code in 
 D like in Python?
 Is it worth it?
If you write JS in a professional environment, you will almost certainly be required to terminate every line with a semicolon because it's too easy to write code that behaves in unexpected ways otherwise. If you spend enough time writing Python, you will start to run into cases where meaningful whitespace makes it difficult to write readable, functional code. Omitting semicolons satisfies a small handful of programmers who don't like having them all over the place, sure, but it alienates everyone who takes development seriously enough that the ambiguity becomes a hinderance.
Sep 19 2016
parent reply Chris Wright <dhasenan gmail.com> writes:
On Mon, 19 Sep 2016 13:06:30 +0000, pineapple wrote:
 If you
 spend enough time writing Python, you will start to run into cases where
 meaningful whitespace makes it difficult to write readable, functional
 code.
For the most part, you can wrap a statement in parentheses in lieu of semicolons.
Sep 19 2016
parent bachmeier <no spam.net> writes:
On Monday, 19 September 2016 at 15:13:10 UTC, Chris Wright wrote:
 On Mon, 19 Sep 2016 13:06:30 +0000, pineapple wrote:
 If you
 spend enough time writing Python, you will start to run into 
 cases where
 meaningful whitespace makes it difficult to write readable, 
 functional
 code.
For the most part, you can wrap a statement in parentheses in lieu of semicolons.
That's called Lisp.
Sep 19 2016