VL : Feature - paste C# code into VL window as Nodes

Paste C# code into VL and have translated nodes appear

I presume this is quite a bit of work / can turn out quite badly without enough time / very low down the list of priorities for sure
But @azeno @Elias - what do you think?

I can see this going 2 ways:

  1. Parse simple blocks of C# (e.g. single function call) and have it translated into a node (or complain that the paste is too complex to become one node)
  2. Translate larger chunks into patches (likely involves some kind of compile/decompile or otherwise relying on a .NET build toolset). Could then go so far as to: drop DLL’s and decompile/translate, open a csproj as a patch, etc

Just being curious

Did you have a look at the Script region yet?

eh?? what?? :) no i didn’t

ok wonderful!
are there any limitations? e.g. interacting with NuGet packages / introducing new types

when did this come?

Around last Christmas I think - was a hacking weekend with @hayden I believe. Anyways it has its quirks I remember, but in general assemblies/nugets referenced from the document should be available inside. You need to write using statements at the beginning of course. You can also define classes inside etc. but at the end you’ll only have this one static entry point called “Script” per region. So no sharing of instances across regions.

Multiple outputs you can do with out parameters.

1 Like

and compiled i presume?

Sure! And called directly. Not even a virtual call.

also had a WIP with a little syntax highlighting and code completion. but there was something with the references not working. anyway, something like this will come at some point:
test773

and as elias said, that’s not a plugin or so, it is directly called without overhead.

5 Likes

Ah wow also some IntelliSense! Did you look into Monaco Editor?

But back to the original topic also
Any thoughts about pasting C# code as NODES?

You mean parsing the C# AST and translating to node tree?

as:

Hm well I think it will be alot of work and the outcome could still be rather bad. So not really sure it’s worth the effort. Little expressions maybe, but entire C# files no way.

It would mean that VL has the same feature set as C#. And that’s not something we’re aiming at. Wanna go more high level in the next developments. Proper IO boxes, patched value viewers and even editors, inspector, proper inspection of values based on instance one is looking at, even traversal of patch based on runtime object graph and not only source code graph, browser like navigation, .NET Core 3.0 next year, NuGet 4 support, easier packaging, standalone, export one single executable 
 those kind of things ;)

9 Likes

I’m not suggesting this as a priority
More just a waste-of-time discussion about whether such a thing is possible or not.
I take the answer is ‘yes but painfully. even thinking about it is painful.’ :)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.