use of multiple languages in visual studio - c#

in visual studio we can develop applications using multiple programming languages such as C#, C++, Visual Basic. Is this due to CLR?

I believe it is.
The functionality of .Net Framework
supporting many programming languages
is due to the use of the powerful CLR
See this link:
http://www.dotnet-guide.com/
The above statement can be found in the 3rd paragraph beneath the "Click here for FREE subscription" button.

Mainly, but I guess it is also a trend for IDEs to support several languages (vs one IDE per language). Eclipse for example supports 20 languages.

The fact that multiple .NET languages share a runtime and BCL, and can talk to each-other very easily is due to the CLR/CLI, but ultimately the VS IDE doesn't just write CLI (unmanaged C++ being the obvious example). Simply, the IDE (like many others) is designed to be extensible.
If you wanted, I'm very sure it would be possible to write your own compiler plugin for VS, using a managed or unmanaged language.

Related

How to add a custom language REPL to Visual Studio

Visual Studio 2017 (and 2015) now features a REPL for interactive C#, F#, R, Python and possibly others. View -> Other Windows -> and whatever is installed should be visible.
Suppose I wanted to integrate my own (existing domain-specific) language into Visual Studio such that its REPL would be started by clicking on a menu item in Other Windows. I am only interested in using Visual Studio's built-in REPL services to conduct a dialogue with an existing language - not to design a language nor to use any of the DSM facilities provided by .Net or Microsoft. At least today.
Where would I begin? Would the Interactive R implementation be a suitable starting point? (The R interpreter would resemble my DSM more closely than say C#)
The appeal here is Visual Studio integration and the ability to reuse existing components.
Based on limited information on your DSL it is necessary to make assumption which equally well may be treated as requirements:
There is a compiler for DSL which is capable to produce partial syntax trees and compiles them to partial binaries, 'method bodies' or there is a compiler based expression evaluator.
There is a runtime on which DSL can be executed even as partial binaries (if the result of a compilation is an intermediate language then you would need virtual machine otherwise system specific runtime library).
There is a lot of work to do the plumbing between input/output interactive window, runtime, compiler between themselves and Visual Studio.
There are several examples which can be analyzed for prior art:
Roslyn Compiler
Scripting https://github.com/dotnet/roslyn/tree/master/src/Scripting
Interactive Services https://github.com/dotnet/roslyn/tree/master/src/VisualStudio/InteractiveServices
One which could be of direct use in REPL project is:
ReplHTML project https://github.com/TiarkRompf/replhtml
There are many toolkits available for fast development of a DSL or in principle for development of any programming language. Check some papers by Tiark Rompf as he was and is working on cross language virtual machines and efficient DSL/programming language development based on Graal VM. He is currently at Purdue University but before that he was working with Martin Odersky at EPFL in Switzeralnd on Scala, programming language development frameworks and their integration with virtual machines.
I would discourage you in using anything R as this is one of the examples from which one should not learn how to work with or develop programming languages.
Final warning: this is a big project which may require much more than one engineer year to complete successfully.

Are async/await keywords only usable with VS 2012+?

Are async/await keywords only usable with VS 2012+ and not usable with the C# compiler, which I could use from command line?
I've read some questions at SO, like:
Will VS 2010 allow me to use the new async and await keywords in C#?
But, I don't really understand how such keywords which must be connected only with such stuff as the compiler/interpreter are connected with the IDE. How it could be?
So if I want to use these features without VS 2012 the single solution is CTP for 2010?
It doesn't sound like a clear logic. Keywords which are linked with the language semantics must be independet from the such stuff as IDE. Interoperability is a main feature for such products, isn't it?
Are async/await keywords only usable with VS 2012+ and not usable with the C# compiler, which I could use from command line?
No, it's fine to build with csc.exe from the command line, so long as it's the C# 5 compiler (as shipped with .NET 4.5).
If you want to develop in Visual Studio though, you'll need to get VS2012 or later. (I really wouldn't use the CTP at this point - there were various bugs fixed in the real release, and there's no need to go through the pain of them now.)
Don't forget there's always the Express range of Visual Studio editions, which are free.

Something between Rails and Asp.net MVC? A "best of both worlds" alternative

I have studied both Rails and .Net, and find myself longing for features in one that exist in the other and vice versa. Rails has a wonderfully simple syntax while the C# IDE does have features that make development easier (unless you are a command-line purist). Is there a language/framework out there that takes the best from both and puts them into one neat package?
If you like the syntax simplicity echo system of rails, and if it is the IDE, there is always ruby/rails IDEs which does same as VS for C#
NetBeans
RadRails
Rubymine
and lot more
Scala
might work for you
Have you by any change had a look at JRuby w/ IntelliJ as the IDE?:
http://jruby.org/
http://www.jetbrains.com/idea/features/ruby_rails.html
I don't quite see the benefit of mixing ASP.NET MVC and Ruby when you have Rails. If you are looking for a IDE that's similar to Visual Studio (with ReSharper) for RoR, I would go for RubyMine. It gives you almost the same feeling as if you are working in Visual Studio.

Which C# IDE offers the most extensive AST access?

the core part of the bachelor thesis which I am writing right now is a plugin for a C# IDE that offers a few refactorings (it comes to more than simple refactorings but I want to keep it simple for the moment).
I've always been working with Visual Studio so far. However, I've heard that their AST access is rather uncomfortable.
Alternatives are MonoDevelop and SharpDevelop. Another way to work with Visual Studios AST would be to access it via a custom ReSharper Plugin.
Does anyone of you have experience in writing Plugins for any of those target applications? What do you think? I appreciate every advice and disadvice.
Thanks,
TH
An advantage of using MonoDevelop or SharpDevelop is that they're open-source, so you can be sure to have full access to the AST - you can go into the core and modify things, if necessary. Another advantage is that they're 100% managed code, so much easier to develop and debug. Plus, you're more likely to be able to get hold of core developers and ask them detailed questions.
If you're interested if working with MonoDevelop, I'd recommend you implement your refactoring directly in the existing Refactoring addin. We'd love to have more refactoring features :)
The codebase has been undergoing a bit of churn in master because we switched to a new AST and a parser based on the Mono C# parser, and the refactorings have not yet been ported over. I'd recommend you head over to our mailing list or IRC and ask some more specific questions there, so we can give you some more specific pointers.
I believe VS 2010 has very good native support for plugins using MEF. Here's a guide:
http://msdn.microsoft.com/en-us/library/dd885242.aspx
You can also use Devexpress DXCore, it's free with CodeRush Express.
The best AST access for refactorings is offered by NRefactory 5, a complete rewrite of the previous NRefactory version (which is used in both SharpDevelop and MonoDevelop).
For SharpDevelop we plan to use the new NRefactory in SharpDevelop 5.0; and MonoDevelop will also migrate to it eventually (MonoDevelop is already using the new AST, but not yet the new type system/semantic analysis).
The main goal for this rewrite was to:
Provide a rich AST with position information for every token, making refactorings easier to write
Improve the semantic analysis performance
Eliminate some bad design decisions from the previous version (IExpressionFinder, and how referenced assemblies are handled)
In the future, you might also want to look at Microsoft's Compiler-As-A-Service.
Also be sure to checkout ReSharper from http://www.jetbrains.com/resharper which is a plug-in for VS that adds many refactorings

Why are some Microsoft languages called "visual"? (Visual C#, Visual Basic .NET, Visual C++)

I understand visual programming languages to be those languages that allow the programmer to to manipulate graphical--rather than textual--objects onscreen to build functionality.
The closest thing I see in C#, VB, etc. is RAD controls, but that is just composing UI and the very simplest functionality -- it has nothing to do with the language itself, even.
Why, then is C# called "Visual C#", Basic .NET called "Visual Basic .NET," etc.?
What is "visual," or what is the rationale or history behind the nomenclature?
I don't think it has to do with the languages themselves being "visual."
From the Wikipedia article:
The term Visual denotes a brand-name relationship with other Microsoft programming languages such as Visual Basic, Visual FoxPro, Visual J# and Visual C++. All of these products are packaged with a graphical IDE and support rapid application development of Windows-based applications.
The languages are not called "Visual". The products are "Visual".
This is from way back before .NET. "Visual" Basic was "Visual" because of the forms development GUI. "Visual" C++ was "Visual" because of MFC and the wizards for creating an MFC application.
I suspect it all dates back to the original Visual Basic. The "visual" part of this was the UI designer...
The Ruby interface generator provided the "visual" part of Visual Basic
The use of the work "Visual" started to get popular with the introduction of Visual C++ version 1.0; it was the first version that ran natively inside Windows, whereas other versions ran in DOS mode even though they were able to produce Windows-runnable code. It has nothing to do with the languages, rather with the environment where the IDE runs.
I guess this is mainly a marketing choice.
It could, however be related to the fact that "Visual Studio" is a GUI, thus a way to "visualize" your code.
I guess it's all going from some event or some product name choice. And now, it just about the brand.
I mean, like, nowadays you can't even think about some IDE called Studio and the same can be said about, for example, Visual Eclipse.

Categories