Now I want touch on something else. I know that some people have been testing it on VB6 and VBA and they haven't been getting the same mileage as I have been with VB.Net. Firstly, I am using GPT-4 not the free 3.5 for this. GPT-4 is far better at writing code than the normal free 3.5 version.
But that's not all, even with GPT-4 I don't expect VBA and VB6 programmers to get as much out of it. After this latest bout I think I understand why now. I've been paying close attention to what it's good at and what it's bad at. VB6 and VBA requires you to be clever, even with simple problems. Modern languages do not require cleverness to solve basic problems. Many simple problems in Python or .Net require a single call to a library function whereas in VB6 it requires a lot more plumbing. What this means is that there is a greater chance for it to get things wrong.
Let me illustrate what I mean with a very simple example. I gave GPT-4 this query:-
Here is what it gave me:-Quote:
Write a function that takes a file name and asyncronously reads it. The file is expected to be a text file encoded in UTF-16 BE format. Let the function read the UTF-16 BE contents and return a String of those contents. Make the function as compact as possible.
Write a version of this function in each of the following languages, VB.Net, C#, Python, and VB6.
VB.Net:-
C#:-Code:Imports System.IO
Imports System.Text
Async Function ReadFileAsync(fileName As String) As Task(Of String)
Using reader As New StreamReader(fileName, Encoding.BigEndianUnicode)
Return Await reader.ReadToEndAsync()
End Using
End Function
Python:-Code:using System.IO;
using System.Text;
using System.Threading.Tasks;
async Task<string> ReadFileAsync(string fileName)
{
using var reader = new StreamReader(fileName, Encoding.BigEndianUnicode);
return await reader.ReadToEndAsync();
}
VB6:-Code:import asyncio
from pathlib import Path
async def read_file_async(file_name: str) -> str:
async with aiofiles.open(file_name, mode='r', encoding='utf-16-be') as f:
return await f.read()
In all 3 modern languages, it doesn't have to be clever, it just does what I ask it but look at how it handles the VB6 version. It's trying to be clever by using ADODB Stream objects to read text file and Timers to fake asynchronous behavior. It's not that good at being clever so the chances of it getting something wrong here is much higher.Code:Option Explicit
Dim Stream As New ADODB.Stream
Dim FileName As String
Dim FileContents As String
Dim ChunkSize As Long
Sub ReadFileAsync(ByVal FileName As String)
Stream.Open
Stream.Type = adTypeBinary
Stream.LoadFromFile FileName
Stream.Position = 0
Stream.Type = adTypeText
Stream.Charset = "UTF-16BE"
FileContents = ""
ChunkSize = 2 ' Read 2 bytes at a time (1 UTF-16 character)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If Not Stream.EOS Then
FileContents = FileContents & Stream.ReadText(ChunkSize)
Else
Timer1.Enabled = False
Stream.Close
MsgBox FileContents
End If
End Sub
Also note it gave me exactly what I asked for in VB.Net, C# and Python but not in VB6. I asked it for a function that returns a String. It didn't know how to accommodate that request while also giving me asynchronous behavior so it settled on using a Sub and giving me the return value through a module level variable.
Have no fear though, I actually did a fair bit of testing with VB6 and GPT-4 does quite adequately overall but it not going to perform nearly as good as it would writing code for a modern language. Also, I'm fairly certain that by the time GPT-5 comes around, it would be able to handle even the most complex VB6 problems as adequately as any other language..

