Jump to page: 1 2 3
Thread overview
for loop parens
Jul 12, 2013
ixid
Jul 12, 2013
bearophile
Jul 12, 2013
ixid
Jul 12, 2013
bearophile
Jul 12, 2013
ixid
Jul 12, 2013
bearophile
Jul 12, 2013
ixid
Jul 12, 2013
Ary Borenszweig
Jul 12, 2013
ixid
Jul 13, 2013
Brad Roberts
Jul 13, 2013
H. S. Teoh
Jul 13, 2013
ixid
Jul 13, 2013
H. S. Teoh
Jul 13, 2013
JS
Jul 13, 2013
H. S. Teoh
Jul 13, 2013
QAston
Jul 13, 2013
Jonathan M Davis
Jul 13, 2013
QAston
Jul 13, 2013
Jonathan M Davis
Jul 13, 2013
QAston
Jul 13, 2013
Ali Çehreli
Jul 13, 2013
monarch_dodra
Jul 13, 2013
ixid
Jul 13, 2013
bearophile
Jul 13, 2013
Russel Winder
Jul 12, 2013
Simen Kjaeraas
Jul 12, 2013
ixid
July 12, 2013
Go and Rust seem to have been able to dispense with the parens in for loops, is this something that would be possible to do in D or are there parsing and grammatical reasons not to do this?
July 12, 2013
ixid:

> Go and Rust seem to have been able to dispense with the parens in for loops, is this something that would be possible to do in D or are there parsing and grammatical reasons not to do this?

Go has chosen a different syntax. I don't think D syntax of for loops can change now...

Bye,
bearophile
July 12, 2013
On Friday, 12 July 2013 at 19:44:43 UTC, bearophile wrote:
> ixid:
>
>> Go and Rust seem to have been able to dispense with the parens in for loops, is this something that would be possible to do in D or are there parsing and grammatical reasons not to do this?
>
> Go has chosen a different syntax. I don't think D syntax of for loops can change now...
>
> Bye,
> bearophile

Humour me. =) Perhaps as a discussion over a D3 language. If curly brackets were required where parens were omitted what would prevent such a syntax in D?
July 12, 2013
ixid:

> If curly brackets were required where parens were omitted
> what would prevent such a syntax in D?

Maybe nothing, beside lot of programmers that want the "freedom" to omit curly brackets :-)

Bye,
bearophile
July 12, 2013
On Friday, 12 July 2013 at 20:02:46 UTC, bearophile wrote:
> ixid:
>
>> If curly brackets were required where parens were omitted
>> what would prevent such a syntax in D?
>
> Maybe nothing, beside lot of programmers that want the "freedom" to omit curly brackets :-)
>
> Bye,
> bearophile

Similarly what are D user's potential issues with Go-like semi-colon rules? And would this be possible as a subset of current D code?

July 12, 2013
ixid:

> Similarly what are D user's potential issues with Go-like semi-colon rules? And would this be possible as a subset of current D code?

Such changes will not happen even in D4. Walter is strongly against the idea of optional semicolons, on the base that semicolons help the parser, so they allow better error recovery and error messages.

Bye,
bearophile
July 12, 2013
On Friday, 12 July 2013 at 20:30:59 UTC, bearophile wrote:
> ixid:
>
>> Similarly what are D user's potential issues with Go-like semi-colon rules? And would this be possible as a subset of current D code?
>
> Such changes will not happen even in D4. Walter is strongly against the idea of optional semicolons, on the base that semicolons help the parser, so they allow better error recovery and error messages.
>
> Bye,
> bearophile

Is there any evidence that these are issues in Go? That sounds like a theoretical objection that isn't attackable when no one has done it but turns out not to be terribly important when someone actually does it.
July 12, 2013
On 7/12/13 5:38 PM, ixid wrote:
> On Friday, 12 July 2013 at 20:30:59 UTC, bearophile wrote:
>> ixid:
>>
>>> Similarly what are D user's potential issues with Go-like semi-colon
>>> rules? And would this be possible as a subset of current D code?
>>
>> Such changes will not happen even in D4. Walter is strongly against
>> the idea of optional semicolons, on the base that semicolons help the
>> parser, so they allow better error recovery and error messages.
>>
>> Bye,
>> bearophile
>
> Is there any evidence that these are issues in Go? That sounds like a
> theoretical objection that isn't attackable when no one has done it but
> turns out not to be terribly important when someone actually does it.

They are not issues in Go, but Walter is strongly against optional semicolons, as bearophile said. Me and others (like you) like optional semicolons, but since Walter doesn't and it's his language, that will not change.

I personally understand much better the code without semicolons, like in Ruby and Python. And making a parser that way isn't that much difficult, and error recovery is as powerful.
July 12, 2013
> They are not issues in Go, but Walter is strongly against optional semicolons, as bearophile said. Me and others (like you) like optional semicolons, but since Walter doesn't and it's his language, that will not change.
>
> I personally understand much better the code without semicolons, like in Ruby and Python. And making a parser that way isn't that much difficult, and error recovery is as powerful.

Yes, I don't expect anyone to change their opinion though frankly the anti-groups opinions feel more like attachment to the status quo than something that's evidently and demonstrably superior.

It seems a pity that D is achieving such power and elegance in some areas while failing to take on some of the syntactic beauty that is within reach. The ultimate language would look something like D crossed with Go in my eyes. It would be interesting if someone were able to make a D subset that showed what it could look like. There is significant value to being easy to read and write, making the language naturally more appealing for users just as speed makes applications much more attractive to users.

July 12, 2013
On 2013-07-12, 22:38, ixid wrote:

> On Friday, 12 July 2013 at 20:30:59 UTC, bearophile wrote:
>> ixid:
>>
>>> Similarly what are D user's potential issues with Go-like semi-colon rules? And would this be possible as a subset of current D code?
>>
>> Such changes will not happen even in D4. Walter is strongly against the idea of optional semicolons, on the base that semicolons help the parser, so they allow better error recovery and error messages.
>>
>> Bye,
>> bearophile
>
> Is there any evidence that these are issues in Go?

I'm not sure how much of a problem it is, especially given that Go has a
strict style guide, but the objection has come up that these two are
very different:

  if i < f() {
      g()
  }

and

  if i < f()
  {
      g()
  }

In the second case, a semicolon is inserted on the same line as the if.

However, like I said, in idiomatic Go, this is simply not a done thing.

-- 
Simen
« First   ‹ Prev
1 2 3