twinBASIC Update: February 4, 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

Web Panel

An unnamed twinBASIC user paid Wayne to fast-track the creation of a web page panel within the twinBASIC IDE.  The panel allows a "fully isolated web page to be docked or floated within the IDE."

One potential use, as showcased in Wayne's screenshot below, is to maintain easy access to an LLM chat bot, such as ChatGPT.

New twinBASIC Package: BigNumber Library

From Wayne's announcement in Discord:

BigNumber library is now an available package for BETA 434. Experimental, uses TomsFastMath static C library. Usage example:

        Dim a As New BigNumber
        Dim b As New BigNumber
        Dim c As New BigNumber
        a = "12345678901234567890"
        b = "98765432109876543210"
        c.AssignMultiplication(a, b)
        Debug.Assert c = "1219326311370217952237463801111263526900"

There's a small test suit in that you can run with BigNumberTests.RunAllTests(). If it fails, it will hit a Debug.Assert, if it passes, it will just return.

The package supports addition, subtraction, multiplication, division, modulus, square, add-modulus, subtract-modulus, multiply-modulus, square-modulus, module-multiplicative-inverse, greatest-common-divisor, least-common-multiple, shift-left, shift-right, negate, absolute, plus reading/writing as decimal-strings, hex-strings, octal-strings, binary-strings. And comparisons are also covered.

This particular work was commissioned by a user here that wishes to remain anonymous, but thanks go to them.

Wayne's Near-Term Plans

From Wayne in Discord:

Next week I'm focusing on getting stability improved (recent IDE regressions plus memory leaks).  I would certainly hope in a week or twos time nobody will want/need to be using the pre 424 betas anymore.

For context, the Discord chat includes several reports of excessive RAM usage forcing manual reloads of the new twinBASIC IDE, especially from tB power users working with very large projects.  

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 over the past week:

Introduction

The General channel covers a wide range of topics related to the ongoing development of the twinBASIC programming language. Conversations this week focused on new IDE features, bug fixes, and discussions around language design.

Key Points

  • A new Webpage panel was added to the IDE, allowing developers to view web content and interact with AI systems like ChatGPT within the IDE. There were some minor z-order quirks noted due to running a second WebView2 instance.

  • Work continued on fixing regressions and memory leaks introduced in recent builds. Stability is a top priority for the coming weeks.

  • There were extensive discussions around COM interfaces, coclasses, and type libraries. This included proper usage, implementation details, and plans for improvements.

  • Unsigned integer types UInteger and ULong were requested. Support is planned post v1.0.

  • Static linking support was expanded, with examples of linking popular libraries like SQLite, libdeflate, and tinf.

  • Minimizing EXE size was discussed, along with compiler optimizations. LLVM was shown to produce binaries nearly identical in size to optimized C++ builds.

  • Backwards compatibility commitments and philosophy were debated. Most agree VB6-compatibility is key to adoption, but some flexibility may be needed long-term.

Conclusion

Good progress was made this week on the IDE and language implementation, while discussions provided valuable feedback on desired features and direction. The top priority remains delivering a stable IDE and compiler as work towards the v1.0 milestone continues.


Here is a summary of the key points from the Docs channel transcript:

  • The New Features wiki was updated to cover features introduced in build 424.

  • A new FAQ was added on dealing with potential false positives from antivirus engines when scanning twinBASIC executables.

  • There was discussion around improving documentation for attributes like [InterfaceId]. A unified attributes reference table was suggested.

  • Adding installer instructions to exclude twinBASIC directories from antivirus scans was proposed to avoid false positives.

  • Updating the FAQ to clarify the subscription-based pricing model was done to avoid misconceptions.

  • The conversation digressed at times into topics like security practices and code signing certificates. While interesting, these were not directly documentation related.

Overall, good progress was made on expanding the project wikis to cover new features and address common questions from new users. Further improvements to attributes documentation and install guides were identified as areas for future work.

Around the Web

tB IDE Comments Addin

sokinkeso is back with another twinBASIC IDE Add-in.

This one adds [Comment] and [Uncomment] buttons to the IDE toolbar and supports both inline (traditional VBx) and multi-line twinBASIC comment syntaxes.

Here's sokinkeso's announcement from Discord:

This is an Add-in that takes advantage of TwinBasic's ability to insert inline and multiline comments. The addin, appears on the IDE with two new buttons (Comment and Uncomment).

Main features:
Line-Mode commenting
This mode works with selecting a number of lines or a single line or just putting the cursor on a line. Clicking the [Comment] button, will comment-out each line separately.

Range-Mode commenting
Select multiple lines or a range of characters in a line and with CTRL+Click on the [Comment] button, a single comment will be created for the whole range.

Uncomment
Put the cursor inside the range of a comment, and click the [Uncomment] button.

Empty lines not commented-out

Line continuation character (_) , is not included inside the comment (Line-Mode)

Keep in mind that tB IDE add-ins have been temporarily disabled in the redesigned IDE.  Thus, this add-in will only run in BETA 423 and earlier (it was tested in BETA 423).  This is a temporary limitation.  Once tB IDE Add-ins are reenabled, this add-in will likely be updated (if necessary) to work in the redesigned version.

Additional information, including the downloadable zip file and a two-minute video demonstration are available in the Comments Addin thread in the show-and-tell Discord channel.

Interlocked64 for Static Linking

fafalone is at it again:

A while back I made Interlocked64.dll. The Interlocked* APIs, which perform atomic operations important for multithreading and kernel mode, are exported by the Windows API only in 32bit; in 64bit, they're only available as compiler intrinsics. So I wrote a C++ DLL to export these intrinsics as callable functions. But you can't use such a DLL in kernel mode. tB now allows for static linking of .obj and .lib files, so I've made a version of this library for use with tB's static linking, which can be used both in regular programs and kernel drivers. It will be merged into the tbKMode package next time that's updated.
GitHub - fafalone/Interlocked64: x64 Interlocked* compiler instrinsics exported by standard DLL
x64 Interlocked* compiler instrinsics exported by standard DLL - GitHub - fafalone/Interlocked64: x64 Interlocked* compiler instrinsics exported by standard DLL

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

  • added: New features enhancing development capabilities, such as the Static Library Example for compression and decompression, and a BigNumberLib package leveraging the TomsFastMath C static library.
  • added: Integration of a WEBPAGE panel within the IDE, including commands for navigation and mobile mode toggling, and a property to enable tracking prevention.
  • improved: Enhancements to static library support with custom implementations for GCC helper functions.
  • improved: User interface improvements with increased contrast for selected tab background in the IDE.
  • fixed: Multiple code generation issues resolved, including ones related to enum/type handling, field accessors, and UDT copying.
  • fixed: Resolved user experience issues such as restoring missing vertical scrollbars, correcting light theme panel backgrounds, and preventing unintended focus shifts in the IDE.
  • fixed: Addressed a critical bug that could freeze the IDE when removing packages.

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

BETA 431

  • fixed: triggering intellisense in a file that has an Import Library statement could crash-restart the compiler
  • fixed: some issues with static LIB file parsing
  • added: Sample 18.    Static Library Example (libdeflate) compression and decompression

BETA 432

  • fixed: Enum/Type auto close block statement insertion not working
  • fixed: Enums (and there members) internal document positions were lost leading to Goto-Definition problems and other issues [ fafalone, discord ]
  • fixed: (regression since 424) vertical scrollbars missing on PROBLEMS and OUTLINE panels
  • fixed: all light theme floating panels had a dark background
  • fixed: codegen issue involving the new streamlined auto implementations for field accessors [ adakordev, discord ]
  • fixed: accidentally clicking on the non-icon areas of the toolbar would take focus away from the current panel [ AntsAntix, discord ]
  • fixed: some edge cases around flag cloberring in the new codegen since BETA 424, affecting tbSellTree and others [ fafalone, discord ]

BETA 433

  • fixed: codegen issue involving copying of non-simple UDTs in some scenarios [ Krool, discord ]
  • improved: increased the contrast of the selected tab background color in the IDE [ FullValueRider, discord ]

BETA 434

  • improved: (static library work) added some custom implementations for some of GCCs use of helpers (usually from libgcc)
  • added: (commissioned work) new BigNumberLib package available on TWINSERV, utilizing TomsFastMath C static library

BETA 435

  • added: (commissioned work) WEBPAGE panel, allowing a fully isolated webpage to be docked or floated within the IDE
  • added: commands tbWebpage_FocusPanel, tbWebpage_ShowPanel, tbWebpage_HidePanel, tbWebpage_GoBack, tbWebpage_GoForward, tbWebpage_Reload, tbWebpage_ToggleMobileMode, tbWebpage_TurnMobileModeOn, tbWebpage_TurnMobileModeOff
  • added: WebView2 EnvironmentOptions.EnableTrackingPrevention boolean property (default True)
  • fixed: double modal dialog bug which could lock up the IDE, affecting package removal [ fafalone, discord ]