twinBASIC Update: November 28, 2021

Highlights include the first major release of file handling statements and functions in twinBASIC, along with talk of providing a tB license to the Rubberduck project.

twinBASIC Update: November 28, 2021

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.


Highlights

FileSystem Implementations Have Arrived!

Wayne has been hitting the FileSystem implementations hard this week.

As of version 0.13.7, all of the following File I/O statements and functions have been implemented in twinBASIC.

Language Statements Implemented

  • Open (Binary / Random modes only)
  • Put
  • Get
  • Print
  • Seek

VBA.FileSystem Library Members Implemented

  • FreeFile
  • EOF
  • LOF
  • FileAttr
  • Loc
  • Seek
  • Reset
  • FileLen
  • FileDateTime
  • GetAttr
  • SetAttr

Improved Unicode Support

In keeping with twinBASIC's improved Unicode support (versus VBx), the Open statement will support an optional Encoding type parameter.  Here's a sample of the likely syntax:

Open "C:\Path\To\File.txt" For Output Encoding "utf8" As #FileNum

Additionally, the Open statement supports Unicode filenames (it uses the CreateFileW API behind the scenes).

The FileLen, LOF, and Loc functions will all support files over 4 GB, something that VBx does not support.  The exact form of that support is still undecided.

Around the Web

twinBASIC Licenses for Open Source Projects

Andrew Mansell asked about the possibility of twinBASIC being available for certain open-source software projects, such as Rubberduck VBA:

"twinBASIC would be a fantastic fit for the front-end... But at the same time, it would be unthinkable to require all contributors to purchase a twinBASIC license to run the build...

Wayne supports the concept–at least in the case of the Rubberduck project (to which he himself is a contributor).  It remains to be seen how that would all actually work out as a practical matter.

Entering twinBASIC License Key

Someone in GitHub asked how to do this recently.  As this could be an issue for others, too, I'll reproduce Wayne's answer here:

. Press F1 then type 'twinBASIC: Enter Licence Key' and then you should be prompted to enter it.

Changelog

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.7, 28th November 2021]

[v0.13.6, 27th November 2021]

[v0.13.5, 26th November 2021]

  • fixed: potential crash after using Erase on a byref array
  • added: implementations for VBA.FileSystem members: FreeFile, EOF, LOF, FileAttr, Loc, Seek, Reset
  • added: intial support for File I/O statements: Open (Binary / Random modes only), Put, Get [ https://github.com/WaynePhillipsEA/twinbasic/issues/279 ]
  • added: warning TB0006 "Record length is ignored in binary mode"

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