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, 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, tweet me @NoLongerSet or email me at mike at nolongerset dot com.
Improvements to the COM References List
Wayne made several improvements to the COM references list this week, including:
More detailed library information
More discoverable search feature
Library symbol / namespace shown in the detailed information
Single-button click to clear COM references search bar
Click on the magnifying glass with the red slash through it to clear the search text with one click (available as of v0.13.56):
twinBASIC Error Info Provided to COM Callers
As of v0.13.48, your COM calling code (e.g., VBA) will return custom error numbers and descriptions that you raise in your twinBASIC DLL:
Fix for Hidden Dialog Windows
One common source of frustration for new (and experienced!) twinBASIC users is the fact that message boxes open hidden behind the VS Code window. This is especially true since Sample 1 shows "Hello, World" inside of a message box...that never appears.
As of version 0.13.51, those dialog boxes should now appear at the top of the z-order as expected. Since this is still considered an experimental fix, the debug console will log a message explaining what just happened:
Around the Web
Important Tip When Converting VBA to twinBASIC Libraries
VBA does not expose its code to the COM world. This makes sense, since there is no way to compile VBA into a .dll. Specifically, the hidden attribute VB_Creatable is set to False by default.
If you import VBA code modules into twinBASIC to create an ActiveX DLL library, you will need to manually change this attribute to True or you will get a "Class not registered" error:
For further discussion, check out this GitHub issue: Trying to use a TwinBasic ActiveX dll gives "Class not registered".
Future Support for Migrating VBA Userforms to twinBASIC
This is outside the scope of achieving 100% backward compatibility with VB6/VBA, but if there is enough interest it sounds like Wayne is open to the idea of providing a migration path for VBA Userforms to twinBASIC.
If this interests you, leave a comment/upvote on the issue at GitHub. You can also subscribe to the issue to track implementation progress.
Future Support for a Reflection API
Check out the discussion here and subscribe to the issue to follow along.
Making Documentation Easy
This is another topic that would benefit greatly from community input at this early stage of its consideration. What would you like to see twinBASIC support in terms of built-in (developer) documentation?
Me, personally? I'm a big fan of Python's Doc Tests feature. So much so that I implemented the feature using
kludgy clever hacks and workarounds in VBA.
Explicit Pointer Support in twinBASIC
I'm not sure if people were taking advantage of time off around the holiday, but there were several extended discussions around potential twinBASIC features this week: userform migrations, reflection API, documentation support. Let's add one more to that list: Pointers.
In this extended discussion, several of the top tB commenters went back and forth over where to draw the line in twinBASIC when it comes to supporting perhaps the lowest level feature of a modern high-level programming language: pointer manipulation.
As is standard in these sorts of extended twinBASIC language feature discussions, the opinions are strong, the discourse is civil, and the learning opportunities for low-level-curious programmers like me are bountiful.
If you've got thirty minutes to spare (or your own strong opinion on pointers), head over to the GitHub discussion page and check it out.
Here are the updates from the past week. You can also find this information by installing the twinBASIC VS Code extension and clicking on the Changelog tab of the extension page:
[v0.13.57, 26th December 2021]
- fixed: compiler crash on illegal If condition, where the condition expression does not return a value (e.g. If MySub() Then) [ https://github.com/WaynePhillipsEA/twinbasic/issues/602 ]
[v0.13.56, 24th December 2021]
- MERRY XMAS EVERYONE! MASSIVE THANK YOU TO ALL TWINBASIC PREVIEWERS [ https://github.com/WaynePhillipsEA/twinbasic/issues/599 ]
- added: 'clear search filter' button next to the search button in the 'ALL AVAILABLE COM REFERENCES' list in project Settings [ https://github.com/WaynePhillipsEA/twinbasic/issues/553#issuecomment-1000148286 ]
- added: compiler warning TB0008 'suspicious call' [ https://github.com/WaynePhillipsEA/twinbasic/issues/208 ]
- fixed: direct calls to Class_Initialize are not allowed, as per VBx, but generate TB0008 compiler warning [ https://github.com/WaynePhillipsEA/twinbasic/issues/598 ]
[v0.13.55, 22nd December 2021]
- improved: discovery of search bar in Available COM References list [ https://github.com/WaynePhillipsEA/twinbasic/discussions/592 ]
- improved: selected reference detailed information now includes the namespace symbol [ https://github.com/WaynePhillipsEA/twinbasic/discussions/592 ]
[v0.13.54, 22nd December 2021]
- fixed: members marked with the Restricted attribute can no longer be invoked via IDispatch::Invoke [ https://github.com/WaynePhillipsEA/twinbasic/issues/577 ]
- added: line-label auto-complete [ https://github.com/WaynePhillipsEA/twinbasic/issues/559 ]
- improved: project Settings -> 'COM References' -> 'Import from file' now auto-enables the imported reference [ https://github.com/WaynePhillipsEA/twinbasic/issues/553 ]
- improved: project Settings -> 'COM References' now show more detailed information once selected
[v0.13.53, 21st December 2021]
- added: App.IsInIDE boolean property
[v0.13.52, 21st December 2021]
- fixed: CustomControls (Sample 6) EXE build was failing due to the typedef change in v0.13.49
[v0.13.51, 21st December 2021]
- improved: debugger now monitors windows created by the compiler process and will force them to the foreground if hidden by the VS Code IDE window [ https://github.com/WaynePhillipsEA/twinbasic/issues/588 ]
- fixed: arrays of typedef types are now output to the generated type libraries correctly [ https://github.com/WaynePhillipsEA/twinbasic/issues/536 ]
[v0.13.50, 21st December 2021]
- improved: if building a DLL fails because the previous DLL could not be unregistered, you will now be prompted to delete the previous DLL file and continue [ https://github.com/WaynePhillipsEA/twinbasic/issues/561 ]
- improved: accessibility/usability of the project settings / build configuration HTML list boxes [ https://github.com/WaynePhillipsEA/twinbasic/discussions/574 ]
[v0.13.49, 20th December 2021]
- fixed: type library creation was outputting coclass parameters wrongly since v0.13.37 [ https://github.com/WaynePhillipsEA/twinbasic/issues/536#issuecomment-998014838 ]
[v0.13.48, 20th December 2021]
- improved: error propagation over the COM-twinBASIC boundary should now retain error information (description, source, etc) [ https://github.com/WaynePhillipsEA/twinbasic/issues/56 ]
[v0.13.47, 20th December 2021]
- fixed: explicit Empty default arguments were causing type library creation to fail [ https://github.com/WaynePhillipsEA/twinbasic/issues/581 ]
- added: 'import from Visual Basic ...' option to the list provided in the VS Code command 'twinBASIC: Create New Project' [ https://github.com/WaynePhillipsEA/twinbasic/issues/582 ]