On 2010-06-01 21:15, Walter Bright wrote:
Lurker wrote:
== Quote from bearophile ([email protected])'s article

In Go you can omit semicolons at the end of lines, so I presume it's
not a
terrible thing for C-like languages:
package main
import " fmt " // formatted I/O.
func main() {
fmt.Printf ("Hello Hello\n")
}

When will D support that? Removing unnecessary semis really pretties
up the
code.

This idea reappears every few years, and even gets folded into a
language now and then. It started with Pascal, and most recently has
appeared in Javascript.

Making parenthesis optional in function calls and semicolons make quite a nice delegate literal syntax:

loop {
        // do something
}

The above is taken from Scala, it calls the "loop" function passing in a delegate literal. The function will loop indefinitely and call the delegate at each iteration.

The idea basically sux because of the maintenance issue. What
maintenance issue? The one where you decide to add a new line of code
before the }. You inevitably forget to go back and append the ; to the
previous line. Even if you do happen to remember, now your diff
visualizer shows 2 lines changed rather than 1.

C got it right and it doesn't need fixing.

(There are other good reasons for the ; I outlined in my blog
http://www.drdobbs.com/blog/archives/2010/05/improving_compi.html )


--
/Jacob Carlborg

Reply via email to