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.
Unit Testing Goes Live!
While still considered an experimental feature, unit testing is now available in twinBASIC. As part of its initial release, there are no setup/teardown methods yet and only module-based unit tests are supported.
You can choose how strict each assertion is by choosing one of three modes:
Here are the rules for each of these modes:
- String comparisons are case-sensitive
- Object default members are not evaluated
- There are no implicit conversions / coercions
- The datatype of the compared values must match exactly (e.g. 5 <> 5.0)
- vbNullString is considered to be unequal to a zero-length String ("")
- Empty is considered to be unequal to zero- length Strings, vbNullString, zero and False
- Null is never considered equal to anything, not even itself, so use the IsNull / IsNotNull assertions to test for it
- String comparisons are case-sensitive
- Object default members are not evaluated
- Apart from the above exceptions, all other comparisons are evaluated as if done directly in twinBASIC code
- String comparisons are case-insensitive
- All comparisons are evaluated as if done directly in twinBASIC code
The unit testing methods are based off of the Rubberduck Assert Class:
Verifies that two specified objects are equal. The assertion fails if the objects are not equal.
Verifies that two specified objects are not equal. The assertion fails if the objects are equal.
Verifies that two specified object variables refer to different objects. The assertion fails if they refer to the same object.
Verifies that two specified object variables refer to the same object. The assertion fails if they refer to different objects.
Fails the assertion without checking any conditions.
Indicates that the assertion cannot be verified.
Verifies that the specified condition is false. The assertion fails if the condition is true.
Verifies that the specified object is Nothing. The assertion fails if it is not Nothing.
Verifies that the specified object is not Nothing. The assertion fails if it is Nothing.
Verifies that the specified condition is true. The assertion fails if the condition is false.
Verifies that at least one of the items in 2 arrays differs at any give index. The assertion fails if all of the items are the same, if the lower bounds and upper bounds are the same, and the ranks (number of dimensions) are the same.
Verifies that all of the items in 2 arrays are equal. The assertion fails if any items is different, if either the lower bounds or upper bounds are different, or if the ranks (number of dimensions) differ.
Passes the assertion without checking any conditions.
As of v0.10.5070, conditional breakpoints are now supported.
To set conditional breakpoints in VS Code, right click in the gutter (where you would normally click to set a breakpoint), and then you'll see the 'Add Conditional Breakpoint...' option. Enter an expression such as 'Index > 500' and twinBASIC will only break at that line if that condition evaluates to TRUE.
Microsoft Access's Nz() Function Added
When I'm writing VBA in Excel or Word, I often forget that the
Nz() function is specific to the Microsoft Access object model. Beginning with v0.10.5101, the
Nz() function is now available as part of twinBASIC's implementation of the VBA library.
One of the biggest challenges Wayne has had with IntelliSense within VS Code is that VS Code auto-selects the top item in the IntelliSense dropdown list when certain keys are pressed. This behavior differed from VBx and seemed like an intractable limitation of the VS Code environment.
Wayne seems to have found a clever way around this limitation. The first item in the IntelliSense dropdown is now the currently typed text. Thus, auto-selecting this item will have no practical effect on the code being written.
Around the Web
Non-commercial / hobbyist License
Wayne opened a discussion about the possibility of adding a hobbyist tier that would sit between the free and professional tiers. It would be a non-commercial license that would support 64-bit compilation, but not native compiler optimizations.
If this is something that would interest you, be sure to add your voice to the discussion.
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.10.5135, 29th August 2021]
- added: SequenceEquals and NotSequenceEquals to the Assert members [ https://github.com/WaynePhillipsEA/twinbasic/issues/54 ]
[v0.10.5101, 28th August 2021]
- fixed: Exit-For and Continue-For wrongly favouring binding to For-Each blocks over For-blocks in nested situations [ https://github.com/WaynePhillipsEA/twinbasic/issues/395 ]
- fixed: support for End Sub / End Function to terminate a Property-Get procedure for backwards compatibility, but with usage warning [ https://github.com/WaynePhillipsEA/twinbasic/issues/394 ]
- added: VBA.Nz() function [ https://github.com/WaynePhillipsEA/twinbasic/issues/397 ]
[v0.10.5080, 27th August 2021]
- fixed: issue with custom IUnknown definition in type library [ https://github.com/WaynePhillipsEA/twinbasic/issues/388 ]
- fixed: Err.Raise issue with binding to some arguments since v0.10.5002 [ https://github.com/WaynePhillipsEA/twinbasic/issues/393 ]
[v0.10.5070, 27th August 2021]
- fixed: incorrect Optional keyword validation error in Property-Set procedures [ https://github.com/WaynePhillipsEA/twinbasic/issues/391 ]
- improved: tweaked intellisense handling to avoid some issues [ https://github.com/WaynePhillipsEA/twinbasic/issues/389 ]
- added: support for conditional breakpoints [ https://github.com/WaynePhillipsEA/twinbasic/issues/385 ]
[v0.10.5021, 26th August 2021]
- fixed: for-loop initializer order bug [ https://github.com/WaynePhillipsEA/twinbasic/issues/390 ]
- fixed: single-line-if-else bug involving implicit with-block dot/bang accessors [ https://github.com/WaynePhillipsEA/twinbasic/issues/387 ]
- added: support for Exit Sub inside a Property-Get procedure for backwards compatibility, but with usage warning [ https://github.com/WaynePhillipsEA/twinbasic/issues/386#issuecomment-906329962 ]
- fixed: issue with custom IDispatch definition in type library [ https://github.com/WaynePhillipsEA/twinbasic/issues/388 ]
[v0.10.5003, 26th August 2021]
- added: support for Exit Function inside a Property-Get procedure for backwards compatibility, but with usage warning [ https://github.com/WaynePhillipsEA/twinbasic/issues/386 ]
[v0.10.5002, 26th August 2021]
- improved: stepping through Select Case blocks now has the same behaviour as VBx [ https://github.com/WaynePhillipsEA/twinbasic/issues/24#issuecomment-905538085 ]
- improved: Err.Raise now shows intellisense signature-help
[v0.10.4980, 25th August 2021]
- improved: tB now shows a warning that conditional breakpoints are not yet supported when trying to use them [ https://github.com/WaynePhillipsEA/twinbasic/issues/385 ]
- fixed: shadowing of Enum qualifiers when there is a procedure named the same as the enum within the same component [ https://github.com/WaynePhillipsEA/twinbasic/issues/384 ]
- improved: markdown formatting is no longer being shown incorrectly within plain text error information [ https://github.com/WaynePhillipsEA/twinbasic/issues/384 ]
[v0.10.4966, 24th August 2021]
- improved: intellisense has been tamed, causing less interference in general typing / code editing [ https://github.com/WaynePhillipsEA/twinbasic/issues/337 ]
- improved: intellisense now accepts the SPACE bar for accepting suggestions [ https://github.com/WaynePhillipsEA/twinbasic/issues/337 ]
- fixed: parameterless DLL declares no longer show up with the 'Run
[v0.10.4909, 24th August 2021]
- fixed: intellisense for the internal Debug object [ https://github.com/WaynePhillipsEA/twinbasic/issues/337#issuecomment-904364480 ]
- fixed: parser issue involving first arg brackets in some instances [ https://github.com/WaynePhillipsEA/twinbasic/issues/54#issuecomment-904362055 ]
[v0.10.4904, 24th August 2021]
- fixed: Object-based UDT field accessors with arguments passed to default members [ https://github.com/WaynePhillipsEA/twinbasic/issues/382 ]
- fixed: inline ByVal with bracketting issue [ https://github.com/WaynePhillipsEA/twinbasic/issues/379 ]
- fixed: enumeration values should not allow duplicates in the same scope [ https://github.com/WaynePhillipsEA/twinbasic/issues/374 ]
[v0.10.4880, 23rd August 2021]
- added: experimental Unit Testing capabilites [ https://github.com/WaynePhillipsEA/twinbasic/issues/54 ]