Search Unity

Future support for other scripting languages

Discussion in 'Scripting' started by Pi_3-14, Nov 29, 2015.

  1. Pi_3-14

    Pi_3-14

    Joined:
    May 9, 2012
    Posts:
    168
    Over the last few years I have picked up JS, C++11, Python and Swift.

    Now it is too painful to go back to C#. Especially after working with Python+NumPy.

    I have learned that it's possible to have Unity use any language that compiles to .NET IL. Essentially you have to compile your code into a .dll and place it in your resources folder. There already exist such compilers for Swift and F#.

    People have been asking for Swift and F# to be integrated properly:
    However, I can't see any way to provide debugging. And I'm not sure whether code completions or "find references for this variable projectwide" type searches would be possible. Without features such as these, it's probably going to be more productive to use a less elegant language.

    I would love to see Script Inspector 3 handle this in-editor, making a true IDE experience.

    My question is: What do Unity need to do to make this happen?

    What is required of Unity? As far as I can see (which is not far at all, everything is very murky here to me) there should be very little work required that would absolutely have to be done by Unity. Maybe some work would be required setting up MonoDevelop or VS to support the new language(s). Connecting it to the relevant compiler, somehow hooking up debugging.

    Can anyone sketch a rudimentary plan of attack?

    If we can see what is involved, it would help us to pace ourselves so that we can jump aboard the train at the right moment. Or maybe build the train?

    π

    PS https://www.assetstore.unity3d.com/en/#!/content/645 (Python Interpreter -- probably not related to this discussion as it is an interpreter, but very cool nevertheless)
     
    pcote likes this.
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    where is the advantage in supporting more languages?
     
  3. Pi_3-14

    Pi_3-14

    Joined:
    May 9, 2012
    Posts:
    168
    @LeftyRighty, the point is not supporting more languages.

    The point is: supporting languages that are more modern.

    Such languages make life easier for the developer. They reduce typing and visual clutter through cleaner syntax. They allow the programmer to transfer ideas more efficiently. They reduce the occurrence of bugs and the time spent tracking bugs. This reduces development time, increases reliability, reusability, transferability, etc. It makes developers and companies more productive. You accomplish more with your day!
     
    pcote and babelville like this.
  4. pcote

    pcote

    Joined:
    Sep 28, 2010
    Posts:
    13
    I totally agree with this. For example, I use FramerJS and coding with CoffeeScript is much easier than JavaScript, yet compiles true JavaScript. CoffeeScript or Swift for Unity could ease the learning curve a lot.
     
    Last edited: Jun 17, 2016
  5. ericbegue

    ericbegue

    Joined:
    May 31, 2013
    Posts:
    1,353
    Isn't C# a modern language and have the characteristics you've listed?
     
    BilalAsadi, Ryiah and JasonBricco like this.
  6. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    C# is one of the most clean languages I've seen, and quite well designed. C# definitely is all about what you named there:

     
    BilalAsadi, Ryiah and Dave-Carlile like this.
  7. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I think you're the first person I've ever met who thinks going from C++ to C# is "painful".
     
  8. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    As to the original question; what Unity would have to do to implement an F# debugger; I don't know for certain but it appears to be very complicated. Unity themselves never figured out how to get Visual Studio to debug correctly; instead a separate company made a third-party plugin called UnityVS, which then got bought out by Microsoft, which then gave that plugin to Unity to bundle with their installer. Unity is also permanently stuck on a .NET 2.0/3.5 hybrid compiler until they finish IL2CPP and thus can not support any language features that require a higher .NET version (so C# 4, 5, and 6 are all still unsupported). They've also taken the stance (mostly a good stance, mostly) that any language they support needs to work on all platforms, so any compiler needs to be free and cross-platform, so generally Mono, and I don't know how great Mono's support of F# is. So, overall, I'd say the chances are very slim that Unity will ever build a debugger for F#. You'd be better off using DLL's and attaching the debugger to the DLL. See here:

    https://msdn.microsoft.com/en-us/library/605a12zt.aspx?f=255&MSPPError=-2147217396
     
  9. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    The only thing that will make it better is once they update what version of c# we can use. Right now, I think c# 6 is out and 7 is already being discussed on some sites. (at least last I checked this is where we were at). There are some nice new features that we can't easily use right now.

    I'm not even sure what you mean by modern. It's not like we're trying to code in Q basics. Any language can have bugs and be easy or hard to track down. It depends on the programmer and the complexity of the code itself.
     
    Last edited: Jun 17, 2016
    BilalAsadi likes this.