dotnet / dotnet/vblang

Discussion / proposal: usage of any installed programming language

Open
#211 94 comments 1 reaction 0 assignees View on GitHub
Discussion
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

As @TrendyTim mentioned in #46:
```
Public Class TestClass
Private vbVar as String
#Language CS
public static void Main()
{
bVar = "From C#";
MoreVBCode();
}
#End Language
Sub MoreVBCode()
End Sub
End Class
```

I think this would be a very nice construct to use the language of choice (for us here VB) and still be able to use any installed language in the cases where another language better fits the job without resorting to different projects in different languages.

Syntax as proposed by @TrendyTim
`#Language CS`
`#Language C`
`#Language C++`
`#Language F#`
`#Language IL`
etc, any installed language should be usable.

Implementation: The #language/#End Language functions should be compiled into a separate assembly using the specific language compiler.

**ADDED**
In the example above, the call to MoreVBCode would cause a circular reference; The main VB assembly references the C# assembly where Main is defined, and this function needs a reference to the main VB assembly.
To fix this, the call to MoreVBCode should be implemented as a delegate,Invoke.
In the generated C# code, all references needed in the VB Assembly must be available in the generated function call.

The c# function above would get the following signature:
void TestClass_Main(Delegate MoreVBCode, out string vbVar);

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.