twinBASIC Update: April 29, 2024

Highlights include my DevCon Vienna twinBASIC recording, massive memory reduction in the IDE, and exciting news regarding the VB6 PhotoDemon project.

twinBASIC Update: April 29, 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:


PROGRAMMING NOTE: Beginning with this installment, the weekly twinBASIC Update feature will run on Mondays instead of Sundays.  After publishing an article seven days a week every single day since September 1, 2020, I finally decided to take one day a week off from writing.  And that day will be Sundays.  Let's hope my newfound laziness doesn't rub off on Wayne ;-).

Highlights

Compiler Memory Consumption Reduced

From Wayne:

BETA 516 brings starting compiler memory consumption down to more reasonable levels.  e.g. PhotoDemon from 1590MB now opens at 930MB, so you can now turn IDE LargeAddressAware off again if you wish.  Lems down from 880MB to 220MB.  StdExe down from 850MB to 195MB.  All examples from 32-bit, but 64-bit projects also benefit similarly.

There's still plenty of scope to bring things down further, but the main purpose here was to get PhotoDemon to not need LAA.  Achievement unlocked.

Discord Chat Summary

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

Introduction

This week's conversations in the twinBASIC Discord server covered a range of topics, from memory optimizations and bug fixes to discussions about calling .NET DLLs and using AI models. The community also explored some of twinBASIC's unique features and how they differ from other BASIC dialects.

Key Points

  • BETA 516 significantly reduced compiler memory consumption, allowing larger projects like PhotoDemon to run without needing Large Address Aware mode enabled.

  • twinBASIC should be able to call functions from .NET DLLs in a similar manner to VB6. This could enable interesting use cases like generating images with AI models.

  • The ReadOnly keyword was discussed as a new feature in twinBASIC that differs from constants. It was recently added to the official new features list.

  • Some inconsistencies were noted with how the twinBASIC IDE handles auto-formatting of code in certain situations, such as when using arrow keys vs Enter. This will be investigated.

  • An issue was reported where form and control sizes differ between design-time and runtime in Windows 11, possibly related to DPI scaling or text size settings.

  • MDI forms are not yet supported in twinBASIC, but they are on the roadmap for implementation this quarter (Apr-Jun 2024).

  • The Dllama project was mentioned as a potential way to integrate AI chat capabilities into any BASIC dialect that can call external DLL functions, including twinBASIC.

Conclusion

Overall, this week showcased the continued progress being made in twinBASIC's development, with a focus on performance optimizations and bug fixes. The community also explored some exciting possibilities for integrating twinBASIC with other technologies like .NET and AI models. While some features like MDI forms are still in development, the project roadmap indicates they should be available soon. The discussions highlighted the active and engaged nature of the twinBASIC community in pushing the boundaries of what's possible with this modern BASIC dialect.

Around the Web

twinBASIC Presentation Recording Now Available

As he has graciously done in the past, Karl Donaubauer has made my fourth annual twinBASIC update presentation for his Access DevCon Vienna conference available to the public on YouTube:

ucDriveCombo Project

Another week, another twinBASIC project from fafalone.  Here's his announcement post from Discord:

While my ucShellBrowse control is capable of displaying a drive list like this, it's really overkill if that's all you need. I thought VB6 and twinBASIC could use a simple but modernized replacement of just the DriveList control. This project is supplied as a VB6 .ctl that has code which runs unmodified in twinBASIC, with 64bit support. Project files for both are provided. For VB6, you must include mUCDCHelper.bas in your projects. In twinBASIC, this module is combined in the same .twin file as the control.
GitHub - fafalone/ucDriveCombo: Modernized DriveList control replacement
Modernized DriveList control replacement. Contribute to fafalone/ucDriveCombo development by creating an account on GitHub.

PhotoDemon and twinBASIC

AI recap of this GitHub issue:

The creator of the popular VB6 photo editing application PhotoDemon, Tanner Helland, posted on GitHub expressing interest in making PhotoDemon compatible with twinBASIC. Some key points:

  • PhotoDemon is a complex, mature VB6 application that could serve as a good "stress test" for twinBASIC's VB6 compatibility. It uses few external dependencies and relies heavily on core VB6 features.

  • The current PhotoDemon codebase can already be imported into twinBASIC and much of the core functionality works in 32-bit mode with no code changes required. A few specific editing features still have bugs.

  • Helland is interested in slowly migrating the codebase to be 64-bit compatible, while maintaining support for the classic VB6 version. He is seeking guidance on best practices for maintaining dual VB6/twinBASIC compatibility.

  • Challenges for 64-bit migration include updating third-party components PhotoDemon relies on. Helland asked if the twinBASIC community could assist in rebuilding those components for 64-bit.

  • twinBASIC community members expressed excitement about assisting with the migration. They noted most of PhotoDemon's Windows API usage is already covered by existing 64-bit compatible twinBASIC declarations.

Overall, this represents an exciting development - a high profile, complex application like PhotoDemon moving to support twinBASIC and 64-bit. It showcases twinBASIC's growing VB6 compatibility and the enthusiasm of the community to support major migration efforts.

twinBASIC Shoutout from the MS Access Video King

Fellow Access MVP Richard Rost, who runs the most popular Microsoft Access-focused YouTube channel, mentioned twinBASIC in his recent article about the various contemporary flavors of BASIC:

Other Types of Basic
There are also some 3rd-party Visual Basic-like programs available, like twinBasic. I may make tutorials for those too. Again, still in planning.
Visual Basic vs. Visual Basic .NET vs. Visual Basic for Applications - Computer Learning Zone
Visual Basic vs. Visual Basic .NET vs. Visual Basic for Applications

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."

  • Significantly Improved Performance: Reduced the initial memory consumption of the IDE compiler dramatically from approximately 880MB to 220MB when opening projects.
  • Enhanced VBP Migration: Streamlined Visual Basic Project (VBP) migration and import processes, which now utilize ExeName32 for setting project paths more accurately, enhancing overall efficiency and responsiveness.
  • New Compiler Options: Added new project options in the compiler settings to disable overflow checks, array bounds checks, and floating point error checks, allowing for more tailored performance optimizations.
  • Improved IDE Responsiveness: Enhanced the responsiveness of the IDE, particularly for editing large projects or on machines with slower CPUs, reducing lag and improving user experience.
  • Increased Compatibility with ActiveX Controls: Improved handling and compatibility with certain windowless ActiveX controls, addressing issues such as recursive instantiation loops and enhancing stability.
  • Fixed Form and Enum Issues: Resolved issues with form corruption due to deserialization errors and fixed crashes caused by malformed Enum declarations, ensuring smoother development workflows.
  • Removed Redundant Settings: Eliminated unnecessary compiler settings related to symbol table management, simplifying configuration and reducing clutter in project settings.

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

BETA 516

  • significantly reduced standard initial IDE compiler consumption when opening projects (e.g. Lems from approx 880MB now down to 220MB)
  • removed: project redundant settings 'compiler.symbolTableDataTypeLookup', 'compiler.symbolTableMaxSizeLookup', 'compiler.symbolTableMaxSizeRaw', 'compiler.symbolTableMaxSizeHash'

BETA 517

  • fixed: some forms that appeared to be corrupt with deserialization errors in the form designer are now fixed [ jpbro, discord ]
  • improved: VBP migration now uses ExeName32 if stored in the VBP to populate the project.buildPath project setting [ Krool, discord ]
  • improved: faster VBP import
  • fixed: 'bad JSON' error when hovering over some elements in the IDE, such as elements that have descriptions containing line-feeds [ Greedo, discord ]
  • fixed: malformed Enum declaration (e.g. missing End Enum) could cause a compiler crash [ fafalone, discord ]

BETA 518

  • fixed: editing PhotoDemon project would often cause a compiler crash-restart

BETA 519

  • improved: reduced IDE lag when editing some large projects such as PhotoDemon

BETA 520

  • improved: IDE responsiveness when editing some large projects such as PhotoDemon, particularly with slow CPUs
  • fixed: some FPU codegen edge cases, causing issues with PhotoDemon color wheel

BETA 521

  • improved: after importing a VBP the App.Path folder is set to the VBP containing folder
  • improved: when a VBP is imported with ExeName32 set, the project build path is set to ${SourcePath}\ rather than ${SourcePath}\Build\
  • added: project option Compiler: Disable Overflow Checks, allowing to override IntegerOverflowChecks attribute at the project scope
  • added: project option Compiler: Disable Array Bounds Checks, allowing to override ArrayBoundsChecks attribute at the project scope
  • added: project option Compiler: Disable Floating Point Error Checks, allowing to override FloatingPointErrorChecks attribute at the project scope

BETA 522

  • fixed: importing a VBP would cause ~1MB memory leak per form/usercontrol during import process
  • fixed: ThunderMain root hidden window class is now ThunderRT6Main in built executables [ fafalone, discord ]

BETA 524

  • fixed: issue with some ActiveX controls getting into a recursive loop during instantiation [ RobWubs ]
  • improved: better compatibility with some windowless ActiveX controls, e.g. Xceed SmartUI [ RobWubs ]
  • fixed: (regression since BETA 515) intellisense issue for generic classes exposed from packages [ Tecman, discord ]
  • fixed: keyboard issues in Access form design view, due to IOleObject::Draw implementation activating the Ax control [ Tecman, discord ]

BETA 525

  • fixed: (regression since BETA 511) keyboard focusing issue in UCs with manually built windows [ Tecman, discord ]

BETA 526

  • fixed: prevent potential crash when using Windowless ActiveX controls in tB [ RobWubs ]

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