Is that possible?
Assume I have created numerous components by compiling python then I finally learn enough csharp to switch. How can I build a common assembly without the need to re-write all my old components in csharp?
You can’t even combine VB.NET and C# in the same assembly, and those both run on the CLR, Python is a DLR language so unless someone at Microsoft was very clever and committed, I doubt this is possible.
If code is compiled to a .NET standard assembly you should be able to reference it though from any .NET language. But I don’t even know if python compiled assembly are considered .NET standard or not. @piac ?
I remember you (or someone else) saying that in GH2 ironpython will compile into gha not ghpy. Would that be the way to go?
However, note that the MSIL in the assembly is not CLS-compliant and cannot be directly accessed from other .NET languages.
They were lying. GHA is going to disappear entirely. Both Rhino and Grasshopper will be using the RHP extension for plugins, and you’ll be able to both add commands and components to the same assembly.
More likely I didn’t understand
Will there be a compatiblity tool to convert GH scripts (I know it’s a HUGE work)? I assume the GH1 branch will be deprecated entirely.
I’m probably going to write one.
It’s unclear. There will not be a complete overlap of components between GH1 and GH2. Sure, some will be identical, many will be similar, but plenty (especially those to do with data management) will either be missing entirely or work in drastically different ways. Once the toolset is approaching public-beta-readiness we’ll have to decide how much work it will take to provide upgrade tools for a specific percentage of components.
IronPython-compiled dlls are not really the same as normal .Net dlls. They are the same like a lichen and a whale are both life forms: both are compiled dlls. See a summary here:
IronPython GHPYs are composed of abstruse ClosureCell closureCell2 = PythonOps.MakeClosureCell();
, PythonOps.PushFrame(globalContext, $function.__code__);
, calls etc…: they contain DLR-based code.
In short, GHPYs do the same as GHAs, but they do so in Python.
Simply said then I need to re-write my components in csharp in order to put them in one single assembly?
@piac, how will then compiled python stuff look like when they all switch to RHP?
We’ll have Rhino plugins and GH plugins compiled from python and csharp and vb all with extension RHP, but internally completely different?
This has not been discussed as far as I know. We’ll cross that bridge when we get there.