Closed bamarsha closed 4 years ago
My idea for fixing this is to surround all members of callable classes with __
, but add extension extension methods on the Operation<TIn, TOut>
or ICallable
types with the original names, since extension methods are allowed to have the same name as the class. If we add the extension methods to a namespace that most Q# programs already import, this should be mostly seamless, but technically not 100% backwards compatible unless there's a way to say that a class should always import some associated extension methods (I don't know of a way to do that though).
The classes generated for Q# callables contains several built-in members with names that are not surrounded by
__
. This means they are valid Q# identifiers. If you declare a Q# callable with the same name as one of these members, the C# code does not compile because the member name conflicts with the constructor name.Here is an example:
produces this C# compile error:
Here is a list of names I tried that are valid Q# but produce invalid C#:
Body
AdjointBody
if the operation is adjointable.ControlledBody
if the operation is controllable.ControlledAdjointBody
if the operation is controllable and adjointable.Info
Init
Run
__dataIn
__dataOut
MicrosoftQuantumIntrinsicMessage
for the example above.