twinBASIC Update: March 10, 2024

Highlights include a new Trace Mode debugging feature, improved IntelliSense performance, and details of my upcoming twinBASIC presentation at Access DevCon.

twinBASIC Update: March 10, 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

Trace Mode

From Wayne's announcement in Discord:

For those hard to debug bugs, [you can now] enable a new trace mode for tB running code.  The compiler will then auto insert special codegen at the entry and exit points of every tB procedure, logging them either to the debug console as pictured, or to a file.   The file option is particularly useful, since this provides an easy trace log of your compiled apps (e.g. your tB-generated ActiveX controls) at runtime, just from a project setting.   Particular handy given that our debugger doesn't yet support attaching out-of-process.
The generated trace log includes procedure type, name, and all the live procedure arguments on entry (for all simple datatypes). There are some other planned features, such as reporting the HRESULT and return values on the 'finished in ...' line which will hopefully also make it into the update.
[fafalone]: Is that going to mix properly with our own debug output (in the IDE, at least?)
[WaynePhillipsEA]: You can set the log to output to a file instead of the debug console if you want to keep them separate.  But yes, they will mix fine.  There is also a new Debug.TracePrint statement to add your own log entries.  When trace logging is off, Debug.TracePrint is a proper no-op.

IntelliSense Performance Optimizations

Here's a quick ChatGPT recap of a conversation between fafalone (author of the WinDevLib twinBASIC package, which provides tB wrappers around Windows APIs) and Wayne Phillips (lead twinBASIC developer), regarding improvements to the IntelliSense performance in the twinBASIC IDE:

  • Intellisense performance had regressed in recent builds, with 2+ second delays occurring frequently when using large packages like WinDevLib. According to fafalone, "prior to [BETA] 424, 2 second pauses in projects using WinDevLib were pretty far in between; now it's on nearly every intellisense use." He asked if this would improve in future builds.
  • Wayne confirmed performance would improve and he would look into the regression. He tested but couldn't reproduce the frequent delays fafalone saw.
  • Fafalone clarified the issue was incorrect intellisense triggering, not time to generate results. Wayne was able to reproduce with certain operators.
  • The delays were due to sorting a large intellisense dataset in the IDE's JavaScript. Wayne optimized this sorting algorithm, greatly improving performance.

In summary, incorrect intellisense triggering was fixed and sorting performance optimized, eliminating the frequent delays fafalone had observed. This allows large packages like WinDevLib to have snappy intellisense without delays.

Here's the final note on the topic from Wayne:

With my laptop in no-noise mode*, and BETA 423, opening WinDevLib and typing WinDevLib. somewhere leads to a 4-5 second delay.  In BETA 466 it's almost instantaneous.

*NOTE: Based on the full context of the conversation, I presume that what Wayne refers to as "no-noise mode" is a special CPU-restricted mode meant to reduce fan noise but that can also be used to help test performance-sensitive code.

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:

Recent Releases

  • Beta releases 462-464 fixed various bugs like being unable to open projects and DevTools opening on startup.

  • Beta 466 greatly improved intellisense performance by optimizing how results are sorted.

Bug Fixes

  • Critical restart loop bugs fixed in wdShellCore and wdInterlocked.

  • Missing stdlib implementations added to fix linker errors when using sqlite.

  • Intellisense no longer incorrectly triggers after operators like &, slowing things down.

Future Direction

  • MDI support is expected very soon, coming before finishing usercontrols.

  • ActiveX control generation being improved via commissioned work on a commercial control.

  • After ActiveX work, usercontrol bugs will be tackled.

Comparisons to Other Languages

  • Sorting intellisense results optimized to be near instantaneous like other languages, vs multi-second delays previously.

  • Lack of operator overloading differs from languages like C# that allow it across components.

In summary, much progress has been made recently on releases, bug fixes, and future direction. MDI support is imminent and usercontrol improvements coming soon after ActiveX control generation work. Performance continues to be a priority.

Around the Web

twinBASIC at Access DevCon Vienna

Once again, I will be presenting on the topic of twinBASIC at Karl Donaubauer's Access DevCon Vienna conference, being held online via Microsoft Teams on April 18 and 19, 2024.  Register here.

Here's my topic announcement from the agenda page:

Custom Add-In Creation with twinBASIC: Tailoring Your VBA IDE to Your Workflow

Each year at DevCon, we've seen twinBASIC evolve, leading to one burning question: "What can twinBASIC do for me as an Access developer?" This year, we're not just answering that question — we're putting the power in your hands with a step-by-step process for building a VBA IDE add-in. Imagine if you could build an add-in like MZ-Tools using nothing more than your existing VBA knowledge. With twinBASIC, you can!

In this year's session, you'll experience:

•  A brief update on new features and the status of twinBASIC.
•  A real-world application of twinBASIC, creating an MZ-Tools-style VBA IDE add-in.
•  Installing and using the add-in on other machines.

By the end of this session, you’ll be equipped with the knowledge to use twinBASIC to build your own VBA IDE add-ins, to share them with other developers, and to install them on your other development machines.

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: Overall stability enhancements for editing documents and reduced compiler memory leaks, contributing to a more reliable development experience.
  • added: New project settings and debugging tools, including 'Compilation: Trace Output', 'Compilation: Trace Flags', and Debug.TracePrint, aimed at providing comprehensive tracing capabilities for executables.
  • improved: Trace logs now more readable with the inclusion of symbolic names for known IIDs and DISPIDs, replacing raw GUIDs and values.
  • added: Trace logs enhanced with dynamic placeholders for date and time, facilitating better log management and organization.
  • improved: Intellisense performance optimized for larger projects, ensuring smoother autocompletion and fewer interruptions during code editing.
  • improved: Expanded support for C-static library functions, addressing previous gaps and bolstering compatibility with standard libraries.
  • fixed: Various fixes addressing issues with project loading, compiler stability, and setting breakpoints to enable a more seamless development workflow.

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

BETA 460

  • fixed: for large projects, the crash-restart loop detection could cause the restart process to halt at the 'Please Wait' stage [ Gary Miller, discord ]
  • fixed: some projects would not finish loading with trace mode enabled [ Gary Miller, discord ]
  • fixed: 'Extends Nothing' syntax usage (in project or referenced packages) could lead to an internal buffer overrun, leading to compiler instability
  • fixed: compiler auto restart when editing a document that uses the Import Library feature [ fafalone, discord ]
  • improved: reduced compiler memory leaks when editing documents in some instances [ Gary Miller, discord ]

BETA 461

  • improved: stability when editing documents, e.g. wdShellCore in WinDevLib [ fafalone, discord ]
  • misc: prep work for supporting unique error IDs emitted by the compiler

BETA 462

  • Removed from GitHub

BETA 463

  • Removed from GitHub

BETA 464

  • added: project settings 'Compilation: Trace Output' and 'Compilation: Trace Flags' offering full tracing logs for tB generated executables [ commissioned work ]
  • added: Debug.TracePrint for use in combination with the new tracing features [ commissioned work ]

BETA 465

  • improved: [trace log] known IIDs (internal or via registry) are now reported using their symbolic names rather than raw GUIDs
  • improved: [trace log] known DISPIDs are now reported using their symbolic names rather than raw values
  • added: [trace log] now supports ${DATE} placeholder in output path (YYYYMMDD) [ fafalone, discord ]
  • added: [trace log] now supports ${TIME} placeholder in output path (HHNNSS) [ fafalone, discord ]
  • fixed: (regression since BETA 424) intellisense triggering too often, causing short IDE freezes for large projects/packages [ fafalone, discord ]

BETA 466

  • improved: tweaked the intellisense internal sorting algorithm for better performance in larger projects [ fafalone, discord ]

BETA 467

  • improved: [C-static lib support] implemented missing stdlib functions memchr, strchr, strstr, strcpy, strcat, strncpy, rand_s, abort

BETA 468

  • fixed: (regression since BETA 424) setting breakpoints was not always working and blocking the IDE [ jpbro, discord ]

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