Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

D Language

Discussion in 'Scripting' started by CNCharger, May 24, 2018.

  1. CNCharger

    CNCharger

    Joined:
    May 24, 2018
    Posts:
    2
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Code you write for Unity is almost always written in C#. Outside of Unity, C# is a very popular language while D is still relatively obscure even though D was created first. With D not being a .net language it would be an enormous effort for Unity to support it, and since it already has somewhat similar syntax to C# I don't see what the benefit would be other than to save a handful of D developers from learning C#.

    The biggest issue though I would think is D's lack of support for many of the platforms Unity targets. That would seem to be a huge deal breaker, and it doesn't look like the D community is working very hard to change that.
     
    Last edited: May 24, 2018
    Ryiah likes this.
  3. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    It's not and I wouldn't expect it to. D is sort of like C++, but it's better in some areas and worse in others. The problem is that where it's better than C++, there already exists other languages that are better still than D (like C# or Swift.)
     
    Ryiah likes this.
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,091
    Actually it's entirely possible C# predates D in terms of when development started rather than the first release.

    According to Wikipedia Walter Bright started development of D back in 1999 (no month given) with the change logs on the website pointing at a December 2001 release date.

    https://en.wikipedia.org/wiki/D_(programming_language)#History
    https://digitalmars.com/d/1.0/changelog1.html#new000

    By comparison Wikipedia claims C# started life in January 1999, was publicly announced in July 2000, and saw a first release in January 2002.

    https://en.wikipedia.org/wiki/C_Sharp_(programming_language)#History

    Either way the time period between the two, regardless of whether it was initial development or first release, is too small for one to have had any meaningful lead over the other and established user bases just wouldn't have existed. They both had fair chances at being successful and C# was the winner.

    It isn't replacing C and C++. It isn't even close enough to qualify as competing let alone replacing. I can't remember ever seeing a single job asking for a programmer familiar with the language but seeing a job request asking for C, C++, and/or C# is exceedingly common to the point that it can be hard to find anything else for a domain it occupies.

    Basically without widespread demand for the language there is no chance of it replacing an existing very established one.

    No, it was used to create a tiling terminal emulator. One that, according to my reasonably extensive searches, is either very new or very unpopular. Regardless just making an application for Linux, as is the case here, doesn't automatically qualify it as a "part of Linux". If it did then Unity itself would be part of Linux too.
     
    Last edited: May 24, 2018
  5. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,378
    Well...

    teeechnically speaking there exists a D compiler for .Net which will compile D into CIL which can then be ran in a .net runtime.

    It's not really considered production ready (or as far as I know it's not considered).

    And in the end, it'll create a horribly long and annoying pipeline to write code that will run in Unity (and probably be full of bugs since it's not considered production ready). Nevermind how you'd access the Unity API from said D code.

    ...

    But yeah, no, Unity doesn't actually support D.

    It can in theory just like any language that has some pipeline to .Net can be written in theory.

    But technically being able to, and actually doing, are 2 different things.

    Sure, if you want to TRY and do it for the fun of hacking... have at it. But I doubt that's what you want to do considering you're asking if Unity "uses" it. No, they don't.
     
  6. Owen-Reynolds

    Owen-Reynolds

    Joined:
    Feb 15, 2012
    Posts:
    1,914
    Well, C# had a lot of help from Java and microsoft.

    When Java was sweeping the web ("any browser on any OS can run Java applets -- who cares about Windows") microsoft made a deal with them (SUN) to make their own "Java for Windows." They purposely made it work differently (there's a court case! microsoft lost) and essentially told their customers: sure, we lied, but our version (J++) is better and you have too much code already written in it anyway, so stick with us. What's known as "Embrace and Extend."

    They then transitioned J++ customers to C#. They also gradually stopped supporting the various Visual Basic versions (already running on dot-NET) and transitioned them to C#. So besides having the world's most influential software company using every trick to back it, C# and D compete on their merits.
     
  7. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,378
    They didn't transition vb users to C#.

    They transitioned users to VB.Net.

    I worked in an office that did that very transition. Microsoft offered up a lot of tools to make that transition as easy as possible.

    ...

    Also J++ users were intended to transition to J#. But ended up at C# because support for J# dropped in 2007.

    But that's not because MS forced them over to it. The users moved themself. There was no point in using any of the other .net supported languages since C# was the popular one. For the first 10-15 years of .Net there were tons of languages available out there (they still technically are... just few people use them). But everyone soon was just like why bother, just use C#. And Microsoft acted accordingly and just focused their efforts on C#.

    You could argue MS only put effort into C#. But it's a chicken and egg situation. It's hard to support a diverse set of languages.

    With that said, VB.Net still received a lot of focus from Microsoft because well... VB users love them some VB. (heck C# even took some features originating in VB)
     
    Last edited: May 26, 2018
  8. CNCharger

    CNCharger

    Joined:
    May 24, 2018
    Posts:
    2
  9. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,378
    C languages are dying???

    This is the first I'm hearing of this.

    And even if they were dying... D is NOT the language I'd expect to replace any of them. I would elect Go before D.

    [edit]

    Reading the article you linked. I see Go showing up as a "hot language" in that article.

    It even says this for Java users:
    And it says this about D:
    That article isn't saying any C languages are dying. It is offering up languages you may want to check out depending on what language you currently use a lot of.

    It specifically lists D under C because:
    Note... this is operating under the assumption that if you write C/C++ that you're probably writing embedded stuff.

    Which is sort of a half truth.

    The primary place C/C++ is still used today in the business world IS embedded and low-level stuff.

    With the one exception being video games. Game engines are still primarily written in C/C++ because of the bare-metal efficiency you can get from it, and the huge amounts of libraries available in it.

    ...

    And the reason they're suggesting D to C/C++ developers is to familiarize themselves with a managed language. D is a respectable place to start for that. The language feels more C/C++ like than something like Java/C#, it compiles directly to an executable like C/C++ (unlike a to run in a virtual runtime like Java/C#), yet it introduces a memory manager.

    But it openly admits it's not really used much.

    They're merely suggesting it as a introduction to a realm of software development that primary users of C/C++ may not be familiar with.

    ...

    But yeah, C repeatedly shows up in that list as "you should definitely learn this if you haven't learned it yet".

    Because yeah. C is like the defacto language out there. Nearly all main stream languages borrow SOMETHING from C.
     
    Last edited: May 27, 2018
    Ryiah likes this.
  10. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,091
    Did you even read that article? I'll quote (and add bold emphasis to the important part) the relevant section since you're either incapable of finding it yourself or incapable of understanding it.
    Let's start with the most important part. You said that D is replacing C/C++, but the article clearly says that there are no jobs available for the language.

    What's worse though is the statement that it "may be of little practical use". That's a bad statement to have made about a language because the process of learning a new language for an experienced developer is trivial and will often take a period of time measurable in hours.

    That quote by itself isn't the only condemning factor in the article though. What further condemns the language is that it's only recommended a single time, only for learning a single concept, and only because you won't have to learn how to use the tools and libraries supporting it since you'll have already learned it when you picked up C.

    Which brings us to the last major point... C is recommended multiple times (D only once) and for new developers.
     
    Last edited: May 27, 2018
    lordofduct likes this.
  11. Owen-Reynolds

    Owen-Reynolds

    Joined:
    Feb 15, 2012
    Posts:
    1,914
    About C helping you understand how Java works, that's old advice for one specific reason: using explicit reference and dereference. That's long been considered the way to really understand Reference Types. I'd say C++ will work as well. I also think seeing multiple inheritance and pure-virtual functions is the best way to understand formal interfaces, like what C# uses.

    As far as learning managed memory, it seems like Java (or C#) is fine for that. I mean, besides Reference Types, there's nothing in C# that's going to make a C++ coder say "huh?" Nothing like, say: (a,b,c)=A[7..9] from the Perl family.