Currently using
RemObjects Water Version Numbers
10.0.0.02513 20200515-134931
Compiler 202000515-125753
and “mercury” doesn’t support “NameOf” and “Interpolated Strings”
.
Also on “NameOf” vbnet is case-insensitive in its usage.
Currently using
RemObjects Water Version Numbers
10.0.0.02513 20200515-134931
Compiler 202000515-125753
and “mercury” doesn’t support “NameOf” and “Interpolated Strings”
.
Also on “NameOf” vbnet is case-insensitive in its usage.
Adam,
What verision of VB.net supported?
right now, Mercury is in early alpha phase, and many things are not implemented yet. As such, the current state is no indication of what version of the VB language will be supported.
The goal is that when Mercury ships officials as “1.0”, it will be fully backwards compatible with the current (and last) shipping version of VB.NET from Microsoft.
Interpolated Stirngs are indeed one of man y things still on our like (but they are high up, so hopefully should be done soon).
Curiously, “nameOf
” is provided as a system function for all Elements languages, and as such it should already work ‘for free’. Can you give me an exact example what fails? Also, yes, Mercury will be case insensitive but case preserving — you can type in any case, but you will get (optional) warnings if case mismatches, and APIs such as nameOf
will give you the proper case (i.e. it was as defined).
hth,
marc
Marc,
I am using the following code as a test to see what features, were implemented. As I have implemented them in my fork of the roslyn visual basic compiler.
Imports System.Runtime.CompilerServices
Module Module1
Sub Main()
Dim result0 = (Original())',Proposed())
Console.WriteLine(result0)
End Sub
Function Original(<CallerLineNumber> Optional arg0 As Integer = Nothing, Optional arg1 As Int32? = Nothing, <CallerFilePath> Optional arg2 As String = Nothing) As String
Return String.Format("{0} = ({1}) {2} = ({3}) {4} = ({5})", nameOf(arg0), arg0, nameOf(arg1), arg1, nameOf(arg2), arg2)
' Return $"{NameOf(arg0)} = ({arg0}) {NameOf(arg1)} = ({arg1}) {NameOf(arg2)} = ({arg2})"
End Function
'Function Proposed(<CallerLineNumber> Optional arg0 As Integer, Optional arg1 As Int32?, <CallerFilePath> Optional arg2 As String) As String
' Return $"{NameOf(arg0)} = ({arg0}) {NameOf(arg1)} = ({arg1}) {NameOf(arg2)} = ({arg2})"
'End Function
End Module
NameOf
changes to nameof
when run, which is can be an issue with version control software indicating a change in the file.
you will want to turn off case Auto-fixes in Preferences, to prevent that. in Elements, all compiler system functions are camelCased, so thats the case it prefers; I’ll see if we can work around that by adding an overload named NameOf
with the proper VB case, in libMercury, to avoid triggering that auto-fix and warning in the future.
FWIW, <CallerLineNumber>
& co are not supported yet, but you can use the currentLineNumber
& co system functions instead (current*()):
Function Original(Optional arg0 As Integer = currentLineNumber(), ...
I’ll log a feature request to support these attributes, as well.
Thanks, logged as bugs://84364
The attributes <CallerLineNumber()>
and <CallerFilePath()>
current does work, it is implement implicitly within the VB.net compiler.
Curiously it does, yeah. CallerFilePath doesn’t though, it seems. I’ve amended the issue.
Curious. i get the line, but not the filename. But it only tested on Mac, maybe its a .NET vs Mono issue… I‘ll check.
bugs://84364 got closed with status fixed.