twinBASIC Update: April 14, 2024

Highlights include improved performance and stability, error codes for compile errors, a sneak peek at sokinkeso's External Tools plugin, and version control for twinBASIC.

twinBASIC Update: April 14, 2024

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.

Here are some links to get involved with the project:


Highlights

Error Codes Added for Compilation Errors

Wayne's announcement in Discord:

For the next release ([BETA 496]), all compilation errors now have associated error codes (TB5001 to TB5244 currently), allowing us to associate proper documentation to each of them.  This will also help with localization, when that is available soon.

Improved Compiler Stability

Wayne's announcement in Discord:

I've tried to tackle some of the compiler instability during code editing, now available in BETA 496.  It likely won't resolve everything, but things should be improved.   I'm keen to get feedback on BETA 496 from those of you that have been experiencing a lot of compiler restarts during editing sessions.

The early returns sound promising.

From jpbro:

So far things feel much more stable in 497 (been using it for about an hour with no auto compiler restarts). Great stuff, thanks @WaynePhillipsEA!

From fafalone:

yes first impression is very good; spent about 30min adding things to WinDevLib without any crashes at all, definitely improved

From Gary Miller:

I ran #496 all day today in edit, execute, edit, execute.... without exiting or having to restart the IDE!  Congrats you did it!!    Going to download #497 now and start working with it tomorrow.  I do see about a 10 second load time between when I hit the green arrow to execute and my form comes up.  Maybe there's a little room for optimization there. I also noticed that when I first entered the IDE for the first time I was using only 2329 on the bottom bar but after several edit, execute cycles i was up around 6,400 MB used so still think there's some sizable leaks there.  But oh so much nicer than before! Thank you!

Improved Form Opening Performance

As Gary Miller reported above, he was seeing "about a 10 second load time between when I hit the green arrow to execute and my form comes up."

Wayne addressed the performance issue in BETA 499:

You should see a significant reduction in time between hitting F5 and your form appearing, as of BETA 499.  Down from  5.5secs to 1.5secs on my machine.  It can certainly be reduced further, but I'm unwilling to spend any more time on it at this stage, since not many of us have modules containing ~230K code lines 🙂  For the rest of us, any further performance in this area would be negligible.

Early returns were equally promising in this regard.

From jpbro:

Can confirm that first form appearance after pressing F5 is almost instantaneous in JPBFileFInder now.

From Gary Miller:

#499 - CodeGen performance increased by 80 - 90% for my large project. Anywhere from less than a second to 2 seconds now!  Amazing!

Discord Chat Summary

* Auto-generated via Claude-2-100k on poe.com

Here is a summary of the key points from the General channel transcript for the past week:

twinBASIC has released several new beta builds (495-499) with improvements to compiler stability and reduced crashes/restarts during code editing. Feedback has been positive so far.

Bug Fixes

  • BETA 496 tackles compiler instability during editing. Early feedback indicates improved stability.
  • BETA 499 significantly reduces the delay between hitting F5 and a form appearing (from 5.5 sec to 1.5 sec)

IDE Enhancements

  • All compilation errors now have error codes (TB5001-TB5244) to enable documentation and localization.
  • Work continues on allowing preview of a specific form with F6, regardless of active code file.

VB6 Compatibility

  • More progress on ActiveX control compatibility in Access VBA, though some issues remain.
  • Rename form symbol functionality still needs improvement.

Community

  • Help provided to community members on porting a Pascal AI chatbot to twinBASIC.
  • Preparations underway for an upcoming conference presentation on twinBASIC's progress.

Overall, good progress continues to be made on stability, compatibility, and new features. The community remains engaged in testing and providing valuable feedback.

Around the Web

External Tools Addin Coming Soon!

In the Discord chat, sokinkeso announced another new twinBASIC IDE addin that he has in the works.

There's a preview video available at the above link.  Here are a few screenshots from the video to whet your appetite:

A sample list of external tools that can be called from within twinBASIC.

The tool can be configured to pass project-specific parameters to the external tool.  This would be a great way to integrate a version control tool like GitHub Desktop or TortoiseHg into your twinBASIC workflow.

The settings dialog showing the list of available built-in variables.
winRAR backup sample using built-in variables.

Using Version Control with twinBASIC

The last article I had written on this topic was from the very early days of twinBASIC.  VSCode was still the IDE and import/export command line arguments were the only way to extract source text files from the .twinproj binary.

twinBASIC has come a long way since then, to say the least.

With my upcoming twinBASIC talk at DevCon Vienna 2024, I thought it was time for an update.  While we don't yet have support for external source files (everything must still live in the .twinproj virtual filesystem), twinBASIC now has its own IDE and, with it, built-in support for automatic export to source whenever you save the project.

For all the juicy details, check out Version Control with twinBASIC in 2024:

Version Control with twinBASIC in 2024
Step-by-step instructions for integrating version control into your twinBASIC development operations in 2024.

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.

ChatGPT Changelog Summary

* Auto-generated via ChatGPT, sorted in order of ChatGPT's opinion of "most impactful changes."

  • Improved Compilation and Runtime Performance: Enhanced general compiler stability and significantly boosted the final stage code generation performance by approximately 70%, notably enhancing efficiency for large components.
  • Added Error Handling Enhancements: All compilation stage errors now have specific error codes assigned, facilitating easier identification and resolution of issues.
  • Enhanced Stability with Global Variables: Made further stability improvements specifically around predeclared global variables and typelib defined global variables, reducing potential runtime errors.
  • Streamlined Debugging Experience: Minor hardening of the debugger and fixed issues with debug stepping shortcuts (F8/F10/F11) to allow for repeated use by holding down the keys.
  • Enhanced Form and Control Behavior: Resolved multiple bugs affecting forms and user controls, such as window flashing/redrawing and ghost window appearances in design mode.
  • Added Extensibility Features for IDE Addins: Introduced new read-only properties for Host.CurrentProject to aid in addin development, enhancing the extensibility of the IDE environment.
  • Compatibility Note: Starting from BETA 504, IDE Addins compiled will require at least BETA 504 to operate, ensuring consistency in the development environment.

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

BETA 496

  • improved: all compilation stage errors now have error codes assigned to them, in the range TB5xxx (TB5001 to TB5244 currently)
  • improved: general compiler stability around code editing

BETA 497

  • improved: further stability improvements, around predeclared global variables

BETA 498

  • fixed: edge case with IOleControl::FreezeEvents() implementation causing issue in MS Access when switching between Design/View mode [ fafalone, discord ]

BETA 499

  • improved: final stage codegen performance, roughly 70% faster for very large components [ Gary Miller, discord ]

BETA 500

  • fixed: window flashing/redrawing when a form contains a UserControl [ fafalone, discord ]

BETA 501

  • fixed: (regression since BETA 493) tB generated UCs used in some hosts might show a ghost window on the desktop at design time

BETA 502

  • fixed: (regressions) ActiveX control focus edge case where two tB ActiveX controls could both continuously fight for the focus causing runtime freeze [ commissioned work ]
  • improved: further stability improvements, around typelib defined predeclared global variables
  • fixed: TextWidth / TextHeight implementations to take into account vbCr/vbLf rather than just vbCrLf [ https://github.com//issues/1824 ]

BETA 503

  • fixed: off-by-one error in TextHeight calculation causing two back-to-back line feeds to be counted as one [ https://github.com//issues/1824 ]
  • fixed: End statement inside Form_Load could fail causing Form_Load to be recursively called [ https://github.com//issues/1809 ]
  • improved: some minor debugger hardening
  • fixed: debug stepping keyboard shortcuts (F8/F10/F11) could not be held down to trigger repeated use
  • fixed: muted spurious DEBUG CONSOLE messages of compilation (codegen) error detected in xyz for constant evaluations [ fafalone, discord ]

BETA 504

  • fixed: [Addin Extensibility] failing to load an AddIn would freeze the IDE at the 'Please Wait' stage when opening a project
  • WARNING: IDE Addins compiled in BETA 504+ will require BETA 504+ to run
  • added: [Addin Extensibility] new Host.CurrentProject read-only properties: BaseFolderPath, ProjectID, BuildFileExtension, Architecture, VersionMajor, VersionMinor, VersionBuild, VersionRevision, BuildOutputPath, BuildType [ sokinkeso, discord ]

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