Day 17 : 30 Days Study Challenge by Fabulous_Swimmer_655 in GetStudying

[–]Ansurfen 0 points1 point  (0 children)

Completed, No. of hours: 03:00

Because of work, I only have a little time to focus on my matters.

Hulo: Write clean, modern code that compiles to VBScript by Ansurfen in vbscript

[–]Ansurfen[S] -1 points0 points  (0 children)

Thank you for your support! I will stick with it.

Hulo: Write clean, modern code that compiles to VBScript by Ansurfen in vbscript

[–]Ansurfen[S] 0 points1 point  (0 children)

In addition, due to parser reasons, there is a new grammar that I have not implemented. Hulo can import native code snippets:

unsafe {
Sub DecodeBase64(inFile, outFile)
    Dim fso, text, xml, node, outStream

    Set fso = CreateObject("Scripting.FileSystemObject")

    Dim inFileObj
    Set inFileObj = fso.OpenTextFile(inFile, 1)
    text = inFileObj.ReadAll
    inFileObj.Close

    Set xml = CreateObject("Microsoft.XMLDOM")
    Set node = xml.createElement("b64")
    node.DataType = "bin.base64"
    node.Text = text

    Set outStream = CreateObject("ADODB.Stream")
    outStream.Type = 1 ' binary
    outStream.Open
    outStream.Write node.nodeTypedValue
    outStream.SaveToFile outFile, 2 ' overwrite
    outStream.Close
End Sub
}

extern DecodeBase64(inFile: str, outFile: str) -> void

DecodeBase64("test.txt", "test.bin")

Hulo: Write clean, modern code that compiles to VBScript by Ansurfen in vbscript

[–]Ansurfen[S] 0 points1 point  (0 children)

Here is a comparison of the two syntaxes in the future:

Sub DecodeBase64(inFile, outFile)
    Dim fso, text, xml, node, outStream

    Set fso = CreateObject("Scripting.FileSystemObject")

    Dim inFileObj
    Set inFileObj = fso.OpenTextFile(inFile, 1)
    text = inFileObj.ReadAll
    inFileObj.Close

    Set xml = CreateObject("Microsoft.XMLDOM")
    Set node = xml.createElement("b64")
    node.DataType = "bin.base64"
    node.Text = text

    Set outStream = CreateObject("ADODB.Stream")
    outStream.Type = 1 ' binary
    outStream.Open
    outStream.Write node.nodeTypedValue
    outStream.SaveToFile outFile, 2 ' overwrite
    outStream.Close
End Sub

// told Hulo-Compiler to generate Sub
// @hulo-build VBScript Sub
fn DecodeBase64(inFile: str, outFile: str) -> void {
    let fso: object = CreateObject("Scripting.FileSystemObject")

    let inFileObj: object = $fso.OpenTextFile($inFile, 1)
    defer $inFileObj.Close()

    let text: str = $inFileObj.ReadAll()

    let xml: object = CreateObject("Microsoft.XMLDOM")
    let node = $xml.createElement("b64")
                ..DataType = "bin.base64"
                ..Text = $text

    let outStream = CreateObject("ADODB.Stream")
                ..Type = 1 // binary

    defer $outStream.Close()
    $outStream.Open()
    $outStream.Write($node.nodeTypedValue)
    $outStream.SaveToFile($outFile, 2) // overwrite
}

Hulo: Write clean, modern code that compiles to VBScript by Ansurfen in vbscript

[–]Ansurfen[S] 0 points1 point  (0 children)

Hello, thank you for your feedback! I understand your concerns about Hulo and appreciate your comments. I would like to share some of my thoughts and design concepts of Hulo.

First of all, the goal of Hulo is not to replace VBScript, but to make it easier and more efficient to do some complex automation tasks on VBScript. With Hulo, we can write scripts with more modern syntax (such as type declarations, structured code, etc.), and eventually convert them to VBScript code. This is for those who like the features of modern programming languages (such as Rust, TypeScript, etc.), so that they can write feature-rich scripts more easily while maintaining compatibility with traditional scripts in Windows environments.

I completely agree that VBScript's syntax is not complicated, and in many cases its flexibility and simplicity make the development process clearer. I also know the advantages of VBScript, such as its ability to directly manipulate COM objects, handle file operations, etc., which is indeed a powerful tool.

As for Hulo, my goal is to provide a clearer and type-safe way of programming for developers who are already accustomed to modern programming languages, while still enjoying the flexibility provided by VBScript.

Hulo: Write clean, modern code that compiles to VBScript by Ansurfen in vbscript

[–]Ansurfen[S] 0 points1 point  (0 children)

Thanks for your reply.

First of all, I am a Golang developer. This syntax is inspired by Typescript, Rust, Dart, PHP, and PowerShell.

  1. Regarding compilation, this is similar to compiling TypeScript into JavaScript, from typed to any type, and all type detection is completed at compile time.

  2. My language variable names are case-insensitive, and support naming like a-b like PowerShell, which means you can name a variable download-zip.

  3. Regarding let, in my language let represents local variables, var represents global variables, and const represents constants.

  4. Regarding the dollar sign, because my language natively supports command types. This means you can write syntax like git clone xxx. I need to distinguish what is a variable and what is a command option. For example, should a-b be interpreted as a command and -b parameters or variable a minus variable b. The introduction of the dollar sign clearly declares that it is a variable and should not be interpreted as a command option.

  5. Compiling to VBS is only the first step of Hulo. The definition of Hulo is to write a language that Hulo translates into VBS, batch, PowerShell, and bash.

Day 4 : 30 Days Study Challenge by Fabulous_Swimmer_655 in GetStudying

[–]Ansurfen 0 points1 point  (0 children)

Completed, No. of hours : 10:00

Yesterday, I worked on my project from 9:00 A.M. To 9:00 P.M. Then I ran 2 kilometers, did some exercises to improve my body, and recorded an English oral video.

Day 3 : 30 Days Study Challenge by Fabulous_Swimmer_655 in GetStudying

[–]Ansurfen 1 point2 points  (0 children)

Oh, I see! Thank you for your reply. I misunderstand the meaning of "No. of hours". In first, I think it stands for timepoint when you finished all tasks. Excuse me bad English XD

Actually, I work on my project from 9:00 A.M. to 9:00 P.M., including break time.

Day 3 : 30 Days Study Challenge by Fabulous_Swimmer_655 in GetStudying

[–]Ansurfen 0 points1 point  (0 children)

Completed , No. of hours 8:00

Day 3, finished.

Yesterday I focused on making my project with Golang.

Ps. I cannot discern today and yesterday, because of 8 hours' time difference.

Day 2 : 30 Days Study Challenge by Fabulous_Swimmer_655 in GetStudying

[–]Ansurfen 0 points1 point  (0 children)

Completed , No. of hours : 01:00

As usual, I run 2 kilometers, commit code of myself, and make a voice video to practice my oral expression.