Whidbey

  • Thread starter Thread starter ScottO
  • Start date Start date
S

ScottO

Will Whidbey allow you to convert between different programming languages?

Because all of the languages uses the same CLR it would seem like it would
be possible right inside the IDE.

Today I want to program in VB.NET tomorrow I feel like programming the same
code using C#, J#, or even Cobol.
 
ScottO said:
Will Whidbey allow you to convert between different programming languages?

Then why have different programming languages at all?
Because all of the languages uses the same CLR it would seem like it would
be possible right inside the IDE.

You're right: the differences between C#, J# and VB.net are minimal, and
converting from one to the other would almost be possible. But this does
defeinitely not apply to other .net languages: MC++, P# (a .net prolog
clone) or F# (.net fortran). I think I have seen Perl, Smalltalk and Haskell
implementations in .net - porting C# programs to those languages is far from
trivial, even for humans...

Quite contrary, I hope (and I think I have read so somewhere) that Whidbey
will bring language changes for C# and VB.net that will again increase the
gap between the two, giving reasons for using one or the other again.
Today I want to program in VB.NET tomorrow I feel like programming the same
code using C#, J#, or even Cobol.

You CAN use your code written in VB.net today in C# or cobol projects
tomorrow - that IS the great advantage of the .net environment.

Niki
 
Niki Estner said:
Quite contrary, I hope (and I think I have read so somewhere) that Whidbey
will bring language changes for C# and VB.net that will again increase the
gap between the two, giving reasons for using one or the other again.
The gap will increase with whidbey. While alot of the major C# fuctionality
is in the IDE(refactoring, expansions, better intellisense), the language
will add iterators and anonymous methods which VB will not be adding in
whidbey(although in time they may pick 'em up further down the line). These
particular concepts won't translate directly into VB, although they could be
faked with alot of work. I don't think the code would be particularly
elegant though, as the C# compiler generates a type for iterators and
possibly for an anonymous method. Also, anon methods can capture local
variables which results in some local variables being created on the heap in
an object instead of on the stack...expressing that without language support
would make for a very ugly and confusing piece of code.

VB also has atleast one feature that will thwart this. The VB My namespace
uses a combonation of classes and compiler support and probably couldn't be
converted without virtually reimplementing that part of the compiler and
possibly putting some major work into IDE extensinos or forcing the user to
write code to support the feature. Outside of that, I don't really know if
VB will add anything that further distingushies it, as it isn't my primary
focus. The My namespace is a pretty big chunk of functionality though,
probably the first feature I'm impressed with in VB(not that I want a
version in C#, don't think it'd work as well...it seems like it fits VB's
philosophy and design extremely well though).
You CAN use your code written in VB.net today in C# or cobol projects
tomorrow - that IS the great advantage of the .net environment.

Exactly, just package up the assembly and reuse it. As long as you follow
CLS guidelines, you can usually not even tell what language it was written
in without looking.
 
The gap will increase with whidbey. While alot of the major C# fuctionality
is in the IDE(refactoring, expansions, better intellisense), the language
will add iterators and anonymous methods which VB will not be adding in
whidbey(although in time they may pick 'em up further down the line). These
particular concepts won't translate directly into VB, although they could be
faked with alot of work.

While C# is indeed gaining features which VB.NET may not be (we won't
really know for sure until it ships, of course!), VB.NET *is* gaining
various features that C# has had for a while: XML documentation,
operator overloading and language support unsigned types, to name
three.

I think these, combined with the new features which *both* languages
are getting (such as generics) will make them closer overall than they
are now. Just MHO though.
 
Jon Skeet said:
While C# is indeed gaining features which VB.NET may not be (we won't
really know for sure until it ships, of course!), VB.NET *is* gaining
various features that C# has had for a while: XML documentation,
operator overloading and language support unsigned types, to name
three.

I think these, combined with the new features which *both* languages
are getting (such as generics) will make them closer overall than they
are now. Just MHO though.

From a feature standpoint, yes, you have a point(I keep forgetting VB didn't
have most of those to begin with). But from the underlying compilation model
I'm not so sure. While I think *I* could easily make a trip between the two
and see very little different, I think the new features makes it harder for
a machine to do it. I am looking forward to seeing how things like Reflector
and the other decompilers treat C# code that uses anon methods that capture
locals when viewing it as VB, or to C# when using some of the more esoteric
parts of the My namespaces. While I'm sure they will decompile them
correctly, I wonder what the state of the code will be. I doubt it'll be as
readable once converted.
On the other hand. the My namespaces may be a significant shift. It alone
could, and personally I am hoping it will, make the languages different
enough utility wise to actually give me a reason to use VB again.

In some cases, a conversion from VB to C# will not be semantically
identical. The code will run the same but it will mean (slightly)different
things.
 
Daniel O'Connell said:
From a feature standpoint, yes, you have a point(I keep forgetting VB didn't
have most of those to begin with). But from the underlying compilation model
I'm not so sure. While I think *I* could easily make a trip between the two
and see very little different, I think the new features makes it harder for
a machine to do it. I am looking forward to seeing how things like Reflector
and the other decompilers treat C# code that uses anon methods that capture
locals when viewing it as VB, or to C# when using some of the more esoteric
parts of the My namespaces. While I'm sure they will decompile them
correctly, I wonder what the state of the code will be. I doubt it'll be as
readable once converted.

Oh, I certainly go along with all of that, yes.
 
To be blunt I am disappointed. Maybe it will be a 3rd party's job to allow
for conversion between different .NET programming languages.

"Bob only knows Cobol."
"No problem. We'll just use Cobol.NET to get Bob to begin learning .NET.
Then after he retires in 5 years we'll convert it over to C# or J#."

Maybe I'm just being unrealistic.
 
Hi ScottO,

Althrough VS.net does not support the multi-language converting, you may
get the multi-language re-use through refering multi-language assembly. For
example, you can use Cobol.Net to write a class library assembly, then you
can re-use it in your another C# project through refer this assembly.

Also, there is a tool .Net Reflector, which supports VB and C# decompiler.
Through this tool, you can decompile your Cobol.Net assembly into C# source
code, it may meet your need. For more information, please refer to:
http://www.peterprovost.org/archive/2004/05/02/1185.aspx
http://www.aisto.com/roeder/dotnet/

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
In that case the functionality of .Net Reflector should be made part of
VS.NET and touted as a wonderful supported feature that doesn't exist in the
J2EE world.

Long live the king.
 
Hi ScottO,

I am glad .Net Reflector meets your need. If you need further help, please
feel free to post. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
ScottO said:
In that case the functionality of .Net Reflector should be made part of
VS.NET and touted as a wonderful supported feature that doesn't exist in the
J2EE world.

Long live the king.

"Jeffrey Tan[MSFT]" said:
Hi ScottO,

Althrough VS.net does not support the multi-language converting, you may
get the multi-language re-use through refering multi-language assembly. For
example, you can use Cobol.Net to write a class library assembly, then you
can re-use it in your another C# project through refer this assembly.

Also, there is a tool .Net Reflector, which supports VB and C# decompiler.
Through this tool, you can decompile your Cobol.Net assembly into C# source
code, it may meet your need. For more information, please refer to:
http://www.peterprovost.org/archive/2004/05/02/1185.aspx
http://www.aisto.com/roeder/dotnet/

Scott,

You may also want to take a look at our Decompiler.NET product. In
most cases, it generates more accurate and higher level code than
Reflector that also has the benefit of compiling and running
correctly. It should also be able to convert your compiled Cobol.NET
assemblies into high level readable C# code. You can download a free
trial version from http://www.junglecreatures.com/

Jonathan Pierce
President
Jungle Creatures, Inc.
http://www.junglecreatures.com/
 
In most cases, it generates more accurate and higher level code than
Reflector that also has the benefit of compiling and running
correctly.

This is simply not true. In "most cases" they pretty much do the same
thing.

Actually, Reflector supports Whidbey so given the title of this post
Decompiler.net doesn't handle "most cases" at all :-)
 
This is simply not true. In "most cases" they pretty much do the same
thing.

Actually, Reflector supports Whidbey so given the title of this post
Decompiler.net doesn't handle "most cases" at all :-)

Scott,

Please provide examples rather than making general statements which
are unsupported. The tools do not generate the same output in most
cases. I can provide many examples where Decompiler.NET generates
higher level code that also runs correctly that Reflector 4.0 is
unable to handle correctly. For example, Reflector cannot decompile
the ILReader library correctly written by it's auther where
Decompiler.NET generates code which compiles and runs correctly.
Decompiler.NET also does a much better job with unsafe and COM Interop
code, and is much better at eliminating gotos, merging branches, and
finding higher level constructs like using and foreach statements,
etc.

Whidbey is not yet released, but Decompiler.NET will support Whidbey
2.0 extensions soon at that time or soon thereafter. Since it is a
commercial product, Jungle Creatures, Inc. also provides better
support and fixes any code generation issues as soon as they are
reported. The same is not true regarding non-commercial products like
Reflector. I have reported more than 5 code generation issues that
have not yet been corrected although Reflector 4.0 is much more
complete than previous versions of it.

Please provide a specific non-Whidbey example of code which Reflector
or any other decompiler handles correctly that Decompiler.NET does
not. I can provide many where Decompiler.NET works correctly and none
of the other decompilers avaiable including the other commercial ones
handle correctly.

Try the following example if you don't believe me:

unsafe static bool unsafePointer(string s) {
char[] c = new char[10];
s.CopyTo(0,c,0,10);
fixed(char *p=c){
*(p+5) = 'x';
for (int i = 0; i < 10; i++)
if (*(p+i) == 'p')
return true;
}
return false;
}

Reflector produces code that is incomplete, incorrect, won't compile,
and won't run correctly even if it did:

private static bool unsafePointer(string s)
{
int num1;
char[] chArray1 = new char[10];
s.CopyTo(0, chArray1, 0, 10);
pinned ref char local1 = ref chArray1[0];
local1[10] = 120;
for (num1 = 0; (num1 < 10); num1 += 1)
{
if ((local1 + (num1 * 2)) == 112)
{
return true;

}

}
local1 = 0;
return false;

}


Decompiler.NET however, produces even better code than the original
that also compiles and runs correctly.

static unsafe bool unsafePointer (string s)

{
char[] c;
c = new char[10];
s.CopyTo (0, c, 0, 10);
fixed (char* p = c)
{
p[5] = 'x';
for (int i = 0; (i < 10); i++)
{
if (p == 'p')
{
return true;
}
}
}
return false;
}
 
The question asked in the beginning was if this can be done in
Whidbey.

You used this to advertise your product.

However, your sentence saying "in most cases, it generates more
accurate and higher level code" is not true.

It should read "in a few special cases, it generates more accurate and
higher level code".

All you did below is pointing out how minor the differences between
the free Reflector feature and your commerical tool really are.
*smile*


This is simply not true. In "most cases" they pretty much do the same
thing.

Actually, Reflector supports Whidbey so given the title of this post
Decompiler.net doesn't handle "most cases" at all :-)

Scott,

Please provide examples rather than making general statements which
are unsupported. The tools do not generate the same output in most
cases. I can provide many examples where Decompiler.NET generates
higher level code that also runs correctly that Reflector 4.0 is
unable to handle correctly. For example, Reflector cannot decompile
the ILReader library correctly written by it's auther where
Decompiler.NET generates code which compiles and runs correctly.
Decompiler.NET also does a much better job with unsafe and COM Interop
code, and is much better at eliminating gotos, merging branches, and
finding higher level constructs like using and foreach statements,
etc.

Whidbey is not yet released, but Decompiler.NET will support Whidbey
2.0 extensions soon at that time or soon thereafter. Since it is a
commercial product, Jungle Creatures, Inc. also provides better
support and fixes any code generation issues as soon as they are
reported. The same is not true regarding non-commercial products like
Reflector. I have reported more than 5 code generation issues that
have not yet been corrected although Reflector 4.0 is much more
complete than previous versions of it.

Please provide a specific non-Whidbey example of code which Reflector
or any other decompiler handles correctly that Decompiler.NET does
not. I can provide many where Decompiler.NET works correctly and none
of the other decompilers avaiable including the other commercial ones
handle correctly.

Try the following example if you don't believe me:

unsafe static bool unsafePointer(string s) {
char[] c = new char[10];
s.CopyTo(0,c,0,10);
fixed(char *p=c){
*(p+5) = 'x';
for (int i = 0; i < 10; i++)
if (*(p+i) == 'p')
return true;
}
return false;
}

Reflector produces code that is incomplete, incorrect, won't compile,
and won't run correctly even if it did:

private static bool unsafePointer(string s)
{
int num1;
char[] chArray1 = new char[10];
s.CopyTo(0, chArray1, 0, 10);
pinned ref char local1 = ref chArray1[0];
local1[10] = 120;
for (num1 = 0; (num1 < 10); num1 += 1)
{
if ((local1 + (num1 * 2)) == 112)
{
return true;

}

}
local1 = 0;
return false;

}


Decompiler.NET however, produces even better code than the original
that also compiles and runs correctly.

static unsafe bool unsafePointer (string s)

{
char[] c;
c = new char[10];
s.CopyTo (0, c, 0, 10);
fixed (char* p = c)
{
p[5] = 'x';
for (int i = 0; (i < 10); i++)
{
if (p == 'p')
{
return true;
}
}
}
return false;
}
 
Back
Top