One year of Go
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Fri Nov 12 11:03:53 PST 2010
On 11/12/10 10:57 AM, so wrote:
> Oh it is so brave to enforce that kind of thing, even as an individual i
> don't have a rule for that.
>
>> if(...)
>> {
>> ...
>> }
>
>> if(...) {
>> ...
>> }
>
> You can see both in my code and i have never thought that would offend
> someone.
> Sometimes one of them looks cuter than the other, depending on the
> context :P
>
Yah, the problem is they do different things. Try this:
package main
import "fmt"
func blah() bool {
return false
}
func main() {
x := 5
if(blah()) {
x++;
}
fmt.Printf("%d\n", x)
}
(which prints 5) and then this:
package main
import "fmt"
func blah() bool {
return false
}
func main() {
x := 5
if(blah())
{
x++;
}
fmt.Printf("%d\n", x)
}
(which prints 6). Looks like a major problem to me. Comparing this with
the meager advantage of eliminating semicolons, it seems that things
took a wrong turn somewhere.
Andrei
More information about the Digitalmars-d
mailing list