> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# twinBASIC Update: January 16, 2022
- URL: https://nolongerset.com/twinbasic-update-january-16-2022/
- Published: 2022-01-17T04:32:00.000Z
- Updated: 2026-05-08T13:00:09.000Z
- Description: Highlights include the CompileIf attribute and IsObject function for generics, an experimental package manager, and 10 Guiding Principles of twinBASIC.
- Author: Mike Wolfe
- Tags: twinBASIC Weekly Update, #Import 2026-05-20 02:59

*On April 23, 2021, I helped [Wayne Phillips](twitter.com/WaynePhillipsEA/) introduce the world to [twinBASIC](https://www.twinbasic.com/) at the [Access DevCon Vienna](https://www.donkarl.com/devcon/) conference. I [boldly predicted](https://nolongerset.com/devcon-2021/) 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](https://twitter.com/NoLongerSet) or email me at mike at nolongerset dot com.*

---

## Highlights

### Advanced Conditional Compilation

Wayne introduced a new attribute–`[CompileIf()]`–for more advanced conditional compilation needs. Along with that attribute comes support for an `IsObject()` function that returns–at compile time–whether the variable passed to it is an object or a value type.

This was introduced mainly to support building generic classes, but it opens the door for additional possibilities.

Andrew Mansell provides us with some working [sample code](https://github.com/WaynePhillipsEA/twinbasic/issues/620#issuecomment-1009758942) demonstrating the two new features:

- The `[CompileIf()]` attribute
- The `IsObject()` function

```vba
Public Class Tuple(Of T1, T2)
    Private _item1 As T1
    Private _item2 As T2
    
    Public Property Get Item1() As T1
        Return _item1
    End Property
    [ CompileIf (Not IsObject(Of T1)) ]
    Public Property Let Item1(Value As T1)
        _item1 = Value
    End Property
    [ CompileIf (IsObject(Of T1)) ]
    Public Property Set Item1(Value As T1)
        Set _item1 = Value
    End Property
        
    Public Property Get Item2() As T2
        Return _item2
    End Property
    [ CompileIf (Not IsObject(Of T2)) ]
    Public Property Let Item2(Value As T2)
        _item2 = Value
    End Property
    [ CompileIf (IsObject(Of T2)) ]
    Public Property Set Item2(Value As T2)
        Set _item2 = Value
    End Property
    
End Class

Public Class Foo
    Public Test As String
End Class

Module Test
    Public Sub Main()
        Dim x As New Tuple(Of Integer, Double)
        x.Item1 = 1
        x.Item2 = 3.1415792
        
        Debug.Print x.Item2
        
        Dim y As New Tuple(Of Foo, Foo)
        Set y.Item1 = New Foo
        Set y.Item2 = New Foo
        y.Item2.Test = "Hello Generics!"
        
        Debug.Print y.Item2.Test

    End Sub
End Module
```

As part of this implementation, Wayne has [disallowed passing variants](https://github.com/WaynePhillipsEA/twinbasic/issues/620#issuecomment-1008916618) as generic types. This makes sense, since generics provide a more compile-time-safe solution to many of the same problems that Variants currently solve.

### Experimental Package Manager

On January 13, 2022, Wayne launched a "HIGHLY EXPERIMENTAL" package manager for twinBASIC. 

As far as I can tell, most of the details of the package manager have only been discussed in the [twinBASIC Discord server](https://github.com/WaynePhillipsEA/twinbasic/discussions/629). Here are some screenshots:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/01/image-40.png)

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/01/image-41.png)

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/01/image-39.png)

There are several things to note about the current state of the package manager (these are all subject to change):

- All packages include full source code
- All uploaded packages are public
- Wayne has "turned off authentication for now, so at the moment everyone publishes under the same publisher id (TEST-PUBLISHER)"
- Version number supports Major.Minor.Build.Revision so [semantic versioning](https://semver.org/) is possible

Planned updates include:

- Support for commercial/private packages
- Curated list of recommended licenses (Apache 2.0, MIT, GPL, etc.)
- Package moderation (to restrict or identify low-quality packages)
- Publisher accounts (I assume)

To test out the new Package feature, press F1 in VSCode then type "twinBASIC: Create new project", press Enter, then choose "Sample 7\. Package."

### Unit Testing Improvement

When running unit tests, the message accompanying failed assertions [now includes](https://github.com/WaynePhillipsEA/twinbasic/issues/661#issuecomment-1013833760) both the expected value and the actual value.

## Around the Web

### twinBASIC Guiding Principles

Ben Clothier has been leading the community through an exercise in distilling the essence of the twinBASIC project. 

The **10 Guiding Principles** (not *quite* finalized):

1. Backward compatibility trumps everything
2. Community is essential
3. Solving problems is the point
4. Readable code is better than terse code
5. Transparency rocks
6. Consistency matters
7. One way is better than several ways
8. Refactoring and testing should be natural
9. Documentation is important
10. Shipping will be tripping

Be sure to check out [Ben's post](https://github.com/WaynePhillipsEA/twinbasic/discussions/610#discussioncomment-1959505) for the accompanying detailed descriptions that go along with each point.

### Array Initialization Syntax

One of the hot topics of discussion this week was if and how to support [inline array initialization](https://github.com/WaynePhillipsEA/twinbasic/issues/657).

Inline initialization like this,`Dim x As Long = 42`, is valid in twinBASIC. If we can do that with simple value types, why not something similar for arrays?

```vba
Dim y(2) As Long = 1, 3, 5
```

Of course, the devil is in the details, and things start to get tricky when you consider support for multi-dimensional arrays and arrays *of* arrays. 

### Associative Array Proposal

Associative arrays are a common data structure in many programming languages. There is no such native datatype in VBx. Rather, most VBA programmers rely on the [Dictionary object](https://nolongerset.com/vba-dictionaries-aka-hash-tables/) from the Scripting Runtime to provide this feature.

Ben Clothier [proposes](https://github.com/WaynePhillipsEA/twinbasic/issues/650) that this data structure be added as a native datatype in twinBASIC. One of the key benefits of making it a native datatype would be the inclusion of compile-time key name checking. The Scripting Dictionary object relies on keys created at *runtime*, and so compile-time key name checking is simply not possible in VBx.

## 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:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/05/image-2.png)

### \[v0.13.75, 16th January 2022\]

- improved: unit test assertions now display the Actual and Expected values in the error information \[ <https://github.com/WaynePhillipsEA/twinbasic/issues/661> \]

### \[v0.13.74, 15th January 2022\]

- fixed: publisher login/register page not showing for first use

### \[v0.13.73, 15th January 2022\]

- added: Revision and Build version number support in packages
- added: publisher authentication (plus login/register screens) for packages
- fixed: compiler crash global variables with compile-errors \[ <https://github.com/WaynePhillipsEA/twinbasic/issues/660> \]
- fixed: ParamArray arguments now supported alongside the Implements-Via feature \[ <https://github.com/WaynePhillipsEA/twinbasic/issues/656> \]

### \[v0.13.72, 13th January 2022\]

- added: HIGHLY EXPERIMENTAL support for packages, and an online package manager
- fixed: renamed 'RGB' parameter to 'RGBA' for RGB\_R/RGB\_G/RGB\_B/RGB\_A functions
- fixed: moved MousePointerConstants, MouseButtonConstants and ClipboardConstants enums over to the VBRUN library
- fixed: code prettifier was stumbling on the LHS of augmented assignment operators \[ <https://github.com/WaynePhillipsEA/twinbasic/issues/651#issuecomment-1010934201> \]

### \[v0.13.71, 10th January 2022\]

- removed: support for passing Variant datatypes as generic specifiers, to help simplify generic implementations \[ <https://github.com/WaynePhillipsEA/twinbasic/issues/620> \]
- added: generic version of IsObject(Of x), useful for generics conditional compilation

### \[v0.13.70, 10th January 2022\]

- added: CompileIf attribute support, allowing for conditional compilation of procedures based on constant expressions that are evaluated at compile-time (...useful for generics) \[ <https://github.com/WaynePhillipsEA/twinbasic/issues/620> \]
- added: generic version of VarType(Of x), useful for generics conditional compilation

### \[v0.13.69, 10th January 2022\]

- improved: added an error for 'API declarations in class modules must be Private' to match VBx and provide consitent behaviour \[ <https://github.com/WaynePhillipsEA/twinbasic/issues/646> \]
- fixed: moved KeyCodeConstants, ColorConstants, SystemColorConstants, FormShowConstants and LoadResConstants over to VBRUN library (previously in VBA) \[ <https://github.com/WaynePhillipsEA/twinbasic/issues/647> \]
- fixed: moved App and Clipboard classes over to VB library (previously in VBA)
- fixed: type library registration for ActiveX DLLs now populates the 'ThreadingModel' in the registry \[ <https://github.com/WaynePhillipsEA/twinbasic/issues/609> \]