News for hackers. Stuff that matters.
Re:Gambas: Visual Basic on Linux by 1wd on Saturday March 14, 2020 @08:15AM (#22574704)
http://gambaswiki.org/wiki/doc/diffvb lists "Differences From Visual Basic" and says "Gambas is not intended to be a clone of Microsoft Visual Basic" and "you can't simply copy your VB projects over and expect them to compile under Gambas".
Re:Gambas: Visual Basic on Linux by smacktoward on Saturday March 14, 2020 @02:11PM (#22577301)
Of course, you can’t copy your Visual Basic projects into Microsoft’s own Visual Basic.NET and expect them to compile there either.
Re:Gambas: Visual Basic on Linux by jsjddbbwj on Saturday March 14, 2020 @08:51AM (#22574909)
>Thankfully, in Gambas you cannot use GOTO to trap errors! Instead, use CATCH, FINALLY or TRY

For error handling goto is generally much clearer than using exceptions.

Re:Gambas: Visual Basic on Linux by wolco on Saturday March 14, 2020 @10:45AM (#22575646)
Cleaner? Prettier? That's a preference. Having the catch below allows you to see everything at once. Complexity can be encapsulation in readable functions/class method names, etc if your catch does too much.
Re:Gambas: Visual Basic on Linux by stan_rogers on Saturday March 14, 2020 @09:18AM (#22575063)
The construction being referenced is On Error [ERR_NO] Goto LABEL, which is not usually local to the error, and, depending on the dialect may be a generic handler that first needs to figure out what error it's handling.
Re:Gambas: Visual Basic on Linux by rsynnott on Saturday March 14, 2020 @02:56PM (#22577694)
Or, worse, and common in classic VB, ON ERROR RESUME NEXT. Which just skips the line that errored.
Re:Gambas: Visual Basic on Linux by throwaway3neu94 on Saturday March 14, 2020 @03:13PM (#22577841)
It sets Err. Which is essentially how SH, C and Go work too.

(With the obvious exceptions of longjmp and panic/defer, global vs local var, and Go forcing to assign the error.)

On Error Resume Next isn't great, but calling it much worse than On Error Goto, or much worse than other languages, is a stretch.

My point is only that people complain about it in VB disproportionally often compared to other languages. (Does that mitigate the issue to some extent, if every VB dev is super aware of it?)

Re:Gambas: Visual Basic on Linux by rsynnott on Sunday March 15, 2020 @01:00AM (#22581404)
I don’t think I’ve ever seen any vb code which actually checks that, though,or dry little, certainly. In C and Go you get something returned, which is a hint that you should maybe do something with it. In VB a magic global variable is set, and then generally ignored.
Re:Gambas: Visual Basic on Linux by iforgotpassword on Sunday March 15, 2020 @09:18AM (#22583320)
That's how I've done it. Enable it before the line(s) in question, then check err.number, and add "On Error Goto 0" after that so you get the default handler again.

Usually much cleaner than jumping to somewhere else, but that had its uses too.

Re:Gambas: Visual Basic on Linux by rsynnott on Sunday March 15, 2020 @09:51AM (#22583476)
Ah. I was never actually a VB programmer, but I did have a few side-jobs porting VB apps (mostly CRUD webapps) to something more modern in the mid-noughties. My experience from that was that real world use of on error resume next was to turn it on and leave it on.
Re:Gambas: Visual Basic on Linux by Mrat on Sunday March 15, 2020 @08:51PM (#22588481)
Dijkstra would hate you