TwinBASIC: A modern BASIC aiming for 100% compatibility with VB6/VBA
twinbasic.com
twinbasic.com
20 years ago I would've opened up VB6 and knocked out a quick GUI for that kind of work, but I never got on to the VB.NET train.
So I spent some time that evening looking at modern VB6 alternatives, but nothing satisfied me: Lazarus might be something I'd look to in the future, but I'm not too keen on Pascal, Gambas is not really suitable for Windows, then there is this and RADBasic that are incomplete.
In the end, I found a nice Tkinter tutorial [1] and managed to get the GUI I envisioned up in an hour.
I've played with Tkinter many years ago, but I basically had to learn from scratch. The speed at which I was able to get up and running led me to conclude that this is how I'll approach these types of requirements from now on.
The GUI didn't even look as bad as I remember Tkinter looking.
QML also has GUI design tools, but it takes much longer to learn and isn't very good at simple GUIs. However it's better when you need to deploy on Android (iOS requires the paid version).
One thing to keep in mind if the LGPL3 license. If the app isn't distributed, then it's fine, but if distributed, it has to be dynamically linked with some ways of swapping the .so/.dylib/.dll
If you have a visual WYSIWYG designer and, importantly, aren't stubbornly intent on reinventing the wheel, then GUI isn't actually that hard.
If you are familiar with VB6 there is not a lot of difference. Set keyword removed. All collection zero based instead of inconsistent 0 and 1 based. A null and empty string are two different things. Parameters are byval by default instead of byref by default. And you get lots of nice features: generic, linq, return keyword, try/catch, etc. Otherwise the syntax is the same, and winform also works in a very similar way.
I did the transition VB6 => VB.net => C# (the latter when VB got deprecated).
Also the cost is both very high (after a handful of months you'd have paid more than what VB3 standard was sold for and the IDE certainly looks way less functional than VB3) and lacks any perpetual license. Also it isn't mentioned anywhere in the preorder page, but since it requires a subscription, that means that it most likely uses some form of online checking DRM, which in turn means that when the company shuts down and/or abandons the project, all that money would be lost forever.
That said i tried the demo version a bit and seemed to be ok, at least unlike other VB-clone attempts this one seems to have a visual designer (though very primitive). The IDE was a bit buggy and very sluggish and the theme felt very alien and not that well made. Why not use native controls like the applications themselves? The way it looks and feels now is like those early WPF demos, full with sluggish motion and blurry text.
Yeah, that's definitely a downside. I appreciate the author believes they can commercialise this more successfully if it's proprietary, but /personally/ I'd prefer something open source. One day I'll finish my own open source VB6 clone.
> There have been at least a couple of those who ended up being abandoned.
You're right. History is littered with abandoned VB6 replacements. Anybody remember GNOME Basic?
Nonetheless, credit where credit is due. Technologically, it looks like TwinBASIC has good foundations. It had a language server, although the VSCode extension is on hold for now. It imports VB6 project files, unlike looser VB6 alternatives like Gambas. And a combined Dim / Let (=) statement is long overdue.
I've been very impressed with everything about twinBASIC so far. There is a free (including commercial use and royalty free distribution) community edition (Windows only, 32bit and 64bit - though the 64bit has a nag screen).
The paid editions add optimised compilation, and (planned) support for Linux, Mac and Android (and possibly Web).
Compared against other products such as Gambas, Xojo (realbasic) or VB.Net it has the advantage of being able to import existing VB6 apps and run them as Windows 32bit apps (much of this is available now, but there is still some way to go for 100% compatibility). RAD Basic may offer compatibility too, but it seems difficult to find an up to date evaluation download.
twinBASIC also goes beyond what VB6 offered - 64bit compilation, multithreading, creating DLLs etc. (some of which could be done with hacks in VB6).
As for a potential market, that is difficult to say. There are still huge numbers of VB6 applications in use, having the ability to move easily to a new language may be attractive for whoever still supports those applications. There is certainly interest, a thread about twinBASIC on VBForums has had almost 400,000 views.
It's an interesting question. It looks like TwinBASIC embraces the OLE/COM/ActiveX model as its native model. VARIANTS and BSTRs. This means advanced patterns like ObjPtr and StrPtr can work, assuming other compatibility is high.
I'm unsure about RAD Basic here, but a contentious thread of VBForums suggests it differs here.
Now, arguably ObjPtr and StrPtr aren't part of the semantics of VB6. Nonetheless, if you want compatibility with some real world code, it needs to work.
(I too have no connection with twinBASIC, except I'm a VB6 fan who is technologically impressed by it.)
I doubt if there will ever be a VB6 revival.
I think they should focus on 100% compatibility, and 64bit code generation.
Perhaps allow the new Apps to connect to modern cloud services instead of MS access, or on premises SQL, preferably without anyone having to touch any code.
Also some kind of project analysis and auto-documentation so the new developers can understand what the project does, would be useful.
100% compatibility seems to be the main focus of the twinBASIC developers. 64bit code is already available. One big issue is ActiveXs - they are supported, but there are few 64bit third-party ActiveXs. So the support of 32bit ActiveXs in 64bit twinBASIC apps is planned but not yet available.
The other key is being able to use all the custom controls etc. Hopefully, your legacy VB codebase had a fear of NIH and you don't have to worry about this.
I've seen a lot of clever systems made in VB, a combination of the developer not knowing any better, and having the perseverance to keep going until they got something that 'worked'.
I can see a use case for TwinBASIC in maintaining these legacy apps, as the VB6 IDE no longer behaves itself under Windows 10/11. If it offers compilation to 64-bit (pseudo)code, then these apps will gain an extension on their usable life.
Often all you need is the manifest. If the app won't run at all after you have added the manifest, then add a call to InitCommonControls(Ex)
Now, VB required some runtime dlls, namely msvbvm60.dll, and several ActiveX controls, but that feels small compared to even the .NET Framework. And tiny compared to your implied comparison with Electron/Chromium.
I've been wanting to see a VB6 successor for a long time. I have debated paying for Xojo but I'm not a fan of their docs and havent built anything worthwhile yet to justify buying a license.
This is a very captive audience.
In companies that deploy software for hundreds of users, that makes a huge difference.
It also has a sister product SpiderBasic that can convert most of PureBasic code to HTML, JavaScript for web deployment
I highly recommend it.
Lazarus comes close but it uses Free Pascal and (maybe because of that) is somewhat niche.
There are many GUI frameworks for Python, but I would like to have such a straightforward-to-use IDE. My current IDE is PyCharm, maybe there are some extensions? Maybe they are buggy?
But surely Microsoft wouldn't indulge in malicious prosecutions over a market they already killed, right?
In 1996 I had just about finished porting my primary consulting project from VB3 to VB4... when VB5 came out and changed everything again. That's when I realized I had been taken for a ride; I cancelled my MSDN membership and began exiting the Microsoft ecosystem for Linux. Haven't touched a Microsoft or Apple product for over twenty years now and life is good.
Please bear in mind that twinBASIC is still pre-release / v0.x, and has not been widely publicized yet. The IDE, and in particular the forms designer, is very recent. Originally an extension to VS Code was envisioned (it's currently paused), but VSC was not extensible enough.
It's under active and rapid development right now, please judge accordingly.
It’s called BASIC because it’s more approachable to beginners. End Sub is not as strange to someone new to programming as a curly brace because it is almost English and less abstract.
VB has its quirks but during its heyday, it was substantially more productive and easier to use than pretty much anything else.
So unless you can somehow convince young talented programmers to abolish 50 years of advancements and go program in an antiquated language again, in a short while there will simply be no option but to finally migrate away.
The correct answer is: who cares.
Those who do care write them like this:
}
}
}
The editor lines it up with what it closes.Closing blocks telling you what they are closing were a good idea in the era when programmers had to line up at a job submission window holding decks of punched cards.
The reason is that blocks indicating what they are closing can assist the compiler in reliably recovering after syntax errors, continue parsing, so that you get as many useful diagnostics from a single compiler pass as possible.
That is almost entirely irrelevant today, though.
Then there are languages like Python that end without a statement due to differing whitespace.
What about 1-based indexing and On Error Resume Next?
Someone who has to wait 10 minutes in line before a job submission window, holding a deck of punched cards, just to find out their program has syntax errors, and then repair as many of them as possible before repunching the cards and lining up again.
And that's about it.