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

I think I must be the only person alive who actually prefers Pascal-style syntax (VB, VB.NET, Delphi, PL/SQL) to C-style syntax. There are lots of small nice things, such as distinct keywords for end blocks ("End Try", "End Loop", "End If"), and syntactic sugar like the "With" keyword. Intellisense in Visual Studio still seems to work better in VB.NET than C#. It does look comparatively simple; but I'd prefer the complexity of my code to be mitigated by the syntax, not exacerbated by it.



I've had to deal with a codebase that's part VB.Net and part C# for the last 6 years.

I don't really feel any pain switching between them, apart from VB.net is a bit annoyingly verbose and I always forget how to do linq lambda functions in it.

One tip I would add is that you can change the colour of the matching {} when you're in a block scope. VS actually highlights the opening and closing of the block. Usually not much of a problem due to auto-indenting, it can help a lot with complex code.

For some idiotic reason the default is a very light grey, but if you make it darker or a different colour, picking out ending } or starting { becomes trivial.


You should try https://viasfora.com/


You're not the only one.

Ada is a lot like this too. I can read, compile and run it in my head during a gerrit review with almost no glitch by now. Written once, read 20 times at least.

There was some talk on HN yesterday about making your code easily changeable. First step is to make it easily readable, understandable. Little things help. End loop helps. Exit loop_name helps. Non-fallthrough case statement help. in / out / in out help so much. Pre and post conditions help also. Clear static types help. Internal functions help. Explicit generic instantiation, while a pita to write, helps a lot at code read time... Lots of lead bullets.


As someone with a passion for programming language design, this is very intriguing indeed. I wonder if a more verbose and explicit language is indeed better...


AppleScript pairs a concise writing syntax with a verbose reading syntax. The writable->readable translation is done automatically on save - think first-class clang-format.

As a simple example you can write an if block with `if...end`, and this will be automatically rewritten as `if...end if`.

I wish every language had built-formatting and also made the reading/writing distinction!


Very cool to know.

Are you the author of the fish shell, bychance?

(I'm a fish user. If you are, I'm super-thankful for fish!)


I have to agree: VB has better syntax, at least for my head. In addition to better block-boundary-matching, I like the type name coming after the variable name. It's silly to put the type first, especially for long ones. And it has a much better SWITCH/CASE statement. Having to use "_" for line continuation can sometimes be annoying, but at least you don't have to deal with semi-colons.

In C-style syntax there's often disagreement on how to format blocks, but there's rarely a disagreement in VB: there's naturally only one choice.

Maybe take the best of VB and Pascal, clean up the key-words by tossing legacy inconsistencies, and produce a next generation "word-oriented" style. #MVBGA!

Related: https://wiki.c2.com/?TheRightWayToDoWordyBlocks


You are not the only one. I can see a few around me, and there aren't that many developers here :)

Personally, I think every balanced marker (parenthesis, block beginning/termination, brackets) adds a maintainabiliy cost and is better replaced by some unbalanced alternative (on the case of blocks, semantic whitespace is the current winner). The largest the thing inside the markers, the higher the cost.


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: