
The future of VBA language isn’t about replacing it. It’s about supercharging it.
Recently, I engaged with a Redditor about the usefulness of ASF in daily VBA programming. The conversation considered the increasing number of attempts to modernize VBA. There are many solutions out there providing tools to users with specific goals: parsing json files, dealing with file encryption, evaluating expressions.
Despite that, very few authors focus their efforts to tackle the oldest pain point for VBA programmers: the frozen primitives (array, collection, dictionary), the motivation for the vast majority of boilerplate code. From this, specialized tools like u/senipah VBA Better Array, u/sancarn stdVBA, u/cristianbuse VBA Array Tools, Tim hall VBA JSON and many others came about. Almost all these libraries can be placed in the tooling category, since they focus on dealing with a specific problem (with the exception of stdVBA for being a framework to make VBA more ergonomic and kill VBA boilerplate code).
Those incredible projects have served as inspiration for many developers and paved the road for new projects that modernize VBA. ASF inherited some of those authors' philosophies, especially the one shown by u/sancarn: make code more ergonomic and go far beyond being a simple tool. As an example, here is a test from a 400+ test suite available for this scripting language:
'@TestMethod("sort")
Private Sub sort_chain_on_objects()
On Error GoTo TestFail
Dim Globals As ASF_Globals
Dim jsonResponse As String
jsonResponse = _
"{" & _
" users: [" & _
" { id: 1, name: 'Alice', sales: 15000, active: true }," & _
" { id: 2, name: 'Bob', sales: 8000, active: false }," & _
" { id: 3, name: 'Charlie', sales: 22000, active: true }" & _
" ]" & _
"};"
GetResult "let response = " & jsonResponse & _
"let topSellers = response.users" & _
" .filter(fun(u) { return u.active && u.sales > 10000 })" & _
" .map(fun(u) { return { name: u.name, bonus: u.sales * 0.1 } })" & _
" .sort(fun(a, b) {" & _
" if (a.bonus > b.bonus) { return -1 };" & _
" if (a.bonus < b.bonus) { return 1 };" & _
" return 0;" & _
" });" & _
"print(topSellers);", True
Set Globals = scriptEngine.GetGlobals
With Globals
actual = CStr(.gRuntimeLog(.gRuntimeLog.Count))
End With
expected = "PRINT:[ { name: 'Charlie', bonus: 2200 }, { name: 'Alice', bonus: 1500 } ]"
Assert.AreEqual expected, actual
TestExit:
Exit Sub
TestFail:
Assert.Fail "Test raised an error: #" & err.Number & " - " & err.Description
Resume TestExit
End Sub
I think if we, as a community of people that really love VBA, can improve our loved language even more, we can make possible that which almost all people think impossible. As an example, we have Web View embedding web pages in userforms and inspiring a new development generation!