Hacker News new | past | comments | ask | show | jobs | submit login

What makes distinct keywords for end blocks nice in your opinion? I feel they are maybe overly verbose.



Harder to mismatch.

In C# the end to an if and a try both look the same. In VB they don't.


This. I flip between both languages all the time and without issue but I have to say in VB.Net I never have to go looking for that random missing brace that is throwing the entire structure off. I spent enough time doing that in my LISP days. :)

As for the complaints of something being verbose, I see people constantly adding comments to close braces to indicate what it was they closed.


The Verboseness starts to get very real when you are dealing with inlined Expressions/Functions. But maybe that's not what a normal VB.NET project has a lot of.

And, for whatever it's worth, it can encourage people to not inline which probably would be more maintainable anyway.

> As for the complaints of something being verbose, I see people constantly adding comments to close braces to indicate what it was they closed.

Lazy commenting. If you are for some reason dealing with code complex enough to need to keep track of it like that, instead take the time to comment what's happening next as a way to help the reader infer.

Because, let's face it, if it's complex enough to need to track those things, there's a decent chance it's worth leaving some explanations of what it's meant to do.


in my opinion, if you are having issues with mismatches braces, you have too much code in your file. I have seen this issue with God classes (which seem to be more prevalent in VB codebases)


If I am at the end of a long code block in C# or JavaScript, I might see this:

          ...lots more code up here...
          return result;
        }
      }
    }
    return -1;
  }
What's that next-to-last "}" for? To find out, I need to scroll way up, and hope the code is properly indented, or use an IDE feature to collapse the block.

But with a Pascal-family language, it would be more like this:

          ...lots more code up here...
          return result
        End If
      End Loop
    End While

    return -1
  End Function

It is more verbose - but its verbosity with a purpose, and it helps me avoid the distracting question "What is ending here?".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: