twinBASIC Update: May 26, 2025

Highlights include a sneak peek of a game-changing AI add-in for the twinBASIC editor, achieving 100% syntax coverage of VB6/VBA, and improved user control support in Access.

twinBASIC Update: May 26, 2025

On April 23, 2021, I helped Wayne Phillips introduce the world to twinBASIC at the Access DevCon Vienna conference. I boldly predicted that twinBASIC (along with the Monaco editor) would replace VBA and its outdated development environment by 2025. With that goal in mind, this weekly update is my attempt to keep the project fresh in the minds of the VBA development community.

Every Sunday Monday week, I will be providing updates on the status of the project, linking to new articles discussing twinBASIC, and generally trying to increase engagement with the project. If you come across items that should be included here, please leave a comment below.

Here are some links to get involved with the project:


Highlights

Arrival of the AI Add-ins

"Hold on to your hats folks...."

That was the message Wayne Phillips sent to the entire twinBASIC Discord server community immediately before the tB IDE Add-in king, sokinkeso, dropped the following bombshell announcement:

Hey @everyone, I believe many of you have thought about it and imagined it...
and now it's coming!!!
A twinBASIC AI Assistant add-in is about to roll out!!
This work is still in progress, but here's a taster...
0:00
/2:45

The video shows a dedicated chat screen inside a twinBASIC IDE panel.

At minimum, the underlying foundation model (ChatGPT, Claude, etc.) was provided with some amount of additional guidance–perhaps in the form of an initial prompt or a bit of "retrieval-augmented generation" (RAG). The full details are a mystery...for now.

Quote by sokinkeso, "I know you may have a lot of questions right now.. I will do a full presentation/analysis in the "Show and tell", when I will officially roll it out.."
I know you may have a lot of questions right now..
I will do a full presentation/analysis in the "Show and tell", when I will officially roll it out..
-sokinkeso

But he wasn't done there. Less than 24 hours later, he posted another video.

And this time, the AI addin was generating simple user interfaces by copying controls to the clipboard for easy pasting into the form designer:

Here's the video:

0:00
/2:20

Be sure to watch until the end to see the add-in generate a simple custom menu for the application:

The section title did say, "Arrival of the AI Add-ins" with an "s", right? As in, "plural"? As in, multiple AI Add-ins? Yes. It did. Check out the "Around the Web" section below for details on the other AI add-in.

twinBASIC is Now Syntax Complete with VB6

In what can only be described as completionist zeal, Wayne has achieved 100% syntax coverage by implementing this little bit of esoteric VBA that I had never seen before:

Sub OnGosubGotoDemo() 
Dim Number, MyString 
 Number = 2 ' Initialize variable. 
 ' Branch to Sub2. 
 On Number GoSub Sub1, Sub2 ' Execution resumes here after 
 ' On...GoSub. 
 On Number GoTo Line1, Line2 ' Branch to Line2. 
 ' Execution does not resume here after On...GoTo. 
 Exit Sub 
Sub1: 
 MyString = "In Sub1" : Return 
Sub2: 
 MyString = "In Sub2" : Return 
Line1: 
 MyString = "In Line1" 
Line2: 
 MyString = "In Line2" 
End Sub

That is some beautifully horrific code.

It's like the GoTo and GoSub statements shared a drunken, anthropomorphic ménage à trois with the VBA Choose function–leading to the heteropaternal superfecundational abomination we see above.

Miracle metaphorical bastard twins aside, twinBASIC's support of these statements represents a significant milestone for the project: 100% backward-compatible syntax coverage of VB6 and VBA.

Discord Chat Summary

* Auto-generated via Claude-3.7-Sonnet

Overview

This week saw significant advancements in the twinBASIC ecosystem, highlighted by the unveiling of an AI Assistant add-in by sokinkeso that generated tremendous excitement within the community. Several language enhancements were implemented, including mouse wheel event support and improvements to UserControl hosting in Access forms. Discussions around language design decisions and multithreading implementation provided valuable insights for developers working with the platform.

AI Integration & Development Tools

  • sokinkeso demonstrated an impressive AI Assistant add-in for twinBASIC that can generate code, provide explanations, and assist with development tasks. Wayne Phillips noted this would potentially be integrated directly into the IDE rather than remaining a separate add-in.
  • Community member 11EJDE11 shared an alternative Claude-based AI assistant implementation created in just 30 minutes, demonstrating the growing interest in AI-powered development tools for twinBASIC.
  • Developers brainstormed potential AI assistant capabilities, including code analysis, refactoring suggestions, documentation generation, and form creation from database schemas.

Language Enhancements

  • Wayne Phillips confirmed that twinBASIC now supports virtually all VBx syntax, with the recent addition of On...GoSub/On...GoTo statements completing this compatibility milestone.
  • Mouse wheel event support was added to several controls (Form, MDIForm, UserControl, PictureBox, TextBox, Frame) thanks to contributions from fafalone, providing a standardized way to handle scroll wheel input.
  • Beta 784 included significant fixes for UserControls hosted in Access forms, with Wayne noting that more improvements are still coming.

Language Design Discussions

  • A discussion about constructor behavior clarified that the As New syntax with parameters (e.g., Dim c1 As New foo(1)) isn't supported because construction happens at first access rather than declaration. Wayne explained this design decision, noting that the preferred syntax is Dim c1 As foo = New foo(1).
  • Community members debated the merits of lazy vs. eager initialization, with several noting that As New is generally considered an antipattern due to its non-deterministic construction timing.
  • Mansellan shared insights about generics implementation, explaining the difference between type-erased generics (as in twinBASIC v1) versus reified generics (as in .NET), with Wayne confirming more generics capabilities will come post-v1.

Multithreading & Advanced Development

  • Fafalone shared progress on a media player control demonstrating twinBASIC's multithreading capabilities, working through deadlocks and race conditions while implementing features like thumbnail preview.
  • Static linking of C code was discussed, with community members sharing tips on how to properly import and link external libraries, particularly for cryptographic operations.
  • Fafalone discovered that Array() can use type inference with generics, demonstrating this with a List(Of T) implementation that accepts arrays of the correct type.

Conclusion

This week marked a significant milestone with the preview of AI assistance capabilities that could dramatically enhance the twinBASIC development experience. The platform continues to mature with both compatibility improvements and modern language features, while the community actively explores advanced use cases like multithreading and interop scenarios. The discussions around language design decisions provide valuable context for developers transitioning from other BASIC dialects or considering twinBASIC for new projects.

Around the Web

tB AI Add-in Redux

In Discord, user [EJ] posted the following:

Just for fun, I had Claude write an AI assistant addin for TwinBasic. It took about 30 minutes all up and works reasonably well - you can send a lot of data to it (just tried 2000 lines of my custom textbox and it found a couple issues). You'll need an API key.

The addin still needs a lot of work which I probably won't do. Feel free to contribute or fork it.

EJ shared the following Claude AI chats used to create the add-in:

0:00
/1:01

The following link to the associated GitHub project was broken at the time of publication. I'm leaving it here as I suspect it may simply be a private repo that [EJ] forgot to share.

https://github.com/11EJDE11/tb-claude

Changelog

Here are the updates from the past week. You can also find this information by visiting the GitHub twinBASIC Releases page.

Releases · WaynePhillipsEA/twinbasic
Contribute to WaynePhillipsEA/twinbasic development by creating an account on GitHub.

AI-Generated Changelog Summary

* Auto-generated via Claude-3.7-Sonnet, sorted in order of its opinion of "most impactful changes."

  • Added Support for Classic VB Flow Control - Implementation of traditional On... GoTo X, Y, Z and On... GoSub X, Y, Z syntax, enhancing compatibility with legacy VB code.

  • Improved Form Designer Experience - Fixed multiple form-related issues including BorderStyle handling and native common controls movement in different ScaleModes, plus resolved issues with UserControls hosted on Access forms.

  • Enhanced Mouse Support - Added MouseWheel event support across multiple controls (Form, MDIForm, PictureBox, UserControl, TextBox, Data, Frame), improving modern user interaction capabilities.

  • Refined Find/Replace Functionality - The Find/Replace panel now remembers settings between sessions and fixed edge cases for project-scope searches, streamlining developer workflow.

  • Performance Improvements - Significantly enhanced performance for the project Trace feature when using 'Buffered' mode, plus various IDE stability fixes.


WARNING: The following issues are present in BETA builds 623 - 784 (the latest build as of publication):

  • IMPORTANT: This is an interim/experimental release. It includes significant changes, so some instability is to be expected. [Editor's Note: Rolling back to BETA 622 may be necessary if any of the KNOWN ISSUES below affect your project.]
  • KNOWN ISSUE: Controls are not being destroyed properly by the form designer, causing big memory leaks (broken in this build)
  • there are known memory leaks in these versions, so memory usage will be higher than at the Version 1.0 release

BETA 779

BETA 780

  • added: support for On... GoTo X, Y, Z syntax
  • added: support for On... GoSub X, Y, Z syntax

BETA 781

  • fixed: On... GoTo/GoSub implementation ignored negative expression results rather than raising an error
  • fixed: some edge cases of IDE Find/Replace panel not working for project-scope search
  • fixed: Win64 debugger could sometimes cause a crash when using the STOP button in the IDE

BETA 782

  • fixed: IDE issue with editing source files that have multi-byte UTF8 characters in the filename [ forliny, discord ]
  • fixed: Native common controls could not be moved around in the form designer if container ScaleMode is not vbTwips [ fafalone, discord ]
  • improved: Find/Replace panel now remembers settings "Whole Word Only", "Match Case", "Pattern Matching", "Regular Expressions" and "Inside Packages" (saved in project meta data)

BETA 783

  • fixed: (regression in BETA 782) corrections to Frame control support, broken in last release

BETA 784

  • fixed: with UC.PreKeyEvents turned on, a UC placed on an Access form would not allow moving the focus if the Tab key was pressed and not consumed by the PreKeyDown event [ commissioned work, Tecman ]
  • fixed: UCs hosted on an Access form would often trigger "Do you want to save changes" in the form designer, even when no changes had been made [ commissioned work, Tecman ]
  • improved: much better performance for the project Trace feature when the 'Buffered' mode is used [ commissioned work, Tecman ]
  • fixed: WM_MOUSEWHEEL handling in UCs to prevent flickering when hosted on MSACCESS forms [ commissioned work, Tecman ]
  • fixed: WM_NCHITTEST not being handled in Data control, causing WM_MOUSEWHEEL events not to reach it [ fafalone, discord ]
  • added: support for MouseWheel event in Form, MDIForm, PictureBox, UserControl, TextBox, Data, Frame controls [ fafalone, discord ]

All original code samples by Mike Wolfe are licensed under CC BY 4.0