Live data from Hacker News

My Vision of D’s Future

dlang.org

201–210 of 211 posts

Re: My Vision of D’s Future

#201

Earlier quoted context omitted.

Compared to Rust: smoother learning curve, and you don't have to fight the compiler so much Compared to Go: much better designed and richer language. Obviously in terms of community, it's much smaller. But if you're ready to "build vs buy" more, or if you have some small scope project, I'd encourage you to try it.

"Fighting the compiler" is a common annoying stereotype, quite often quoted by people who don't even know Rust. After a while of using Rust, you no longer fight the compiler, you know how things work, you design and structure your programs with borrowck in mind from the start.

Initially coming from C++ background, e.g. I had good understanding of its ownership model with move vs copy semantics (unique_ptr vs shared_ptr), I read many Rust blogs, watched a couple of tech talks and read several chapters of the book, so everything looked super promising. I even spend reading about linear and affine type theory.

But I can testify that spending my first days with Rust was a struggle the whole way. It's probably because D had spoiled me a lot by the time I got to Rust. After some time I lost interest as Rust didn't offer anything that I was actually missing in D, while D had much to offer in the areas of things I liked.

Re: My Vision of D’s Future

#202
post #3

As long as we search for stuff on the internet with text terms (i.e. Google ) you've got to enhance the name of the language. If only something boring as DLang, please please do this. I feel bouts of sympathy every time I think of D, and I'm not even a hard core fan or anything. No need to change the logo or anything. Just sneak in something actually searchable ( dlang , or whatever ) in footers and headers of docume…

Not only has that been happening for years, Google will match D when you search for dlang, wouldn't be surprised if the reverse is true. Google has figured this out for you.

Re: My Vision of D’s Future

#203

A major missing feature is checked exceptions. See long discussion thread here: https://forum.dlang.org/thread/hxhjcchsulqejwxywfbn@forum.dl...

This is glossing over the fact that checked exceptions are a very controversial feature and that most language designers (is there any language besides Java that supports them?) do not implement them on purpose.

Why is it controversial? The controversy came from C# vs Java and if you have programmed in both you’d know that exceptions are broken in C#. Broken because you have to catch the base Exception class if you want to avoid crashing and that’s disrecommended by all C# linting tools.

Re: My Vision of D’s Future

#204
post #129

Earlier quoted context omitted.

D already works like this. Scala (Ammonite) works like this. The author isn't complaining about keystrokes; he wants the compile + run process to be faster. Using an interpreter instead of a compiler would make it faster.

Java has the same now (since Java 9 I think).

So you're saying it's as simple as:

java build ./app/ ./app

That's impressive if true as last I worked with Java it was a mess

Re: My Vision of D’s Future

#205
post #119

Earlier quoted context omitted.

And what exactly is the bad thing about that?

To escape the shit show that C and C++ are in their unique ways. In my experience, one of the worst things was working on a proprietary 1M+ LoC codebase. Everything was so painful (despite the feats of engineering being put in the internal infra to support the development processes and the great team members I worked with) that I'll never go back to anything like that if I have the choice. I'm also dissatisfied with…

But, actually Nim compiles to C or very simplistic C++ without requiring you to write C, nor C++. For this reason there are no complications with the new C++ standards and even there is no requirement to understand C or C++. But you can easily use every C or C++ library (even the template ones) and the amount of good quality C and C++ libraries is really very huge. Almost every modern language has capabilities for linking to C, but with C++ the things are not so simple, because of the non standard ABI, across different compilers. With templates the things are becoming even more complicated. For now the easiest and the most reliable way to use C++ libraries from another language is to compile it to C++. Also by compiling to C or C++ you almost automatically cover every platform whether C or C++ compiler is available with very little special support required in the Nim compiler.

Re: My Vision of D’s Future

#206
post #205

Earlier quoted context omitted.

To escape the shit show that C and C++ are in their unique ways. In my experience, one of the worst things was working on a proprietary 1M+ LoC codebase. Everything was so painful (despite the feats of engineering being put in the internal infra to support the development processes and the great team members I worked with) that I'll never go back to anything like that if I have the choice. I'm also dissatisfied with…

But, actually Nim compiles to C or very simplistic C++ without requiring you to write C, nor C++. For this reason there are no complications with the new C++ standards and even there is no requirement to understand C or C++. But you can easily use every C or C++ library (even the template ones) and the amount of good quality C and C++ libraries is really very huge. Almost every modern language has capabilities for li…

D can also use C and C++ libraries (including templates), and with gcc and llvm it covers pretty much all the same architectures/platforms as nim.

> with C++ the things are not so simple, because of the non standard ABI, across different compilers. With templates the things are becoming even more complicated. For now the easiest and the most reliable way to use C++ libraries from another language is to compile it to C++

This turns out not to be true. The only way to parse C++ is to use a C++ compiler; there is no negotiability there. However you can, as calypso[1] and dpp[2] (latter is not ready for primetime yet) do, use the c++ compiler to parse the c++ and then emit bindings in another language. As for ABI, there are really only two ABIs: msvc (which microsoft uses), and itanium (which everyone else uses). And D already implements both.

1: https://github.com/Syniurge/Calypso

2: https://github.com/atilaneves/dpp

Re: My Vision of D’s Future

#207
post #162

Earlier quoted context omitted.

The interpreter thing could work better in the current software landscape if it could be integrated in Jupyter notebooks. Nowadays many people are migrating to Python to use machine learning in Jupyter or just to run machine learning code in Python.

It's already possible to use D with Jupyter, but an interpreter will make it a lot faster.

With all the libraries?

The base language is nice (and kind of expected), but for D-lang to grow in this space it needs port/replacements for at least NumPy, SciPy, Pandas, and Matplotlib.

Re: My Vision of D’s Future

#208
post #205

Earlier quoted context omitted.

But, actually Nim compiles to C or very simplistic C++ without requiring you to write C, nor C++. For this reason there are no complications with the new C++ standards and even there is no requirement to understand C or C++. But you can easily use every C or C++ library (even the template ones) and the amount of good quality C and C++ libraries is really very huge. Almost every modern language has capabilities for li…

D can also use C and C++ libraries (including templates), and with gcc and llvm it covers pretty much all the same architectures/platforms as nim. > with C++ the things are not so simple, because of the non standard ABI, across different compilers. With templates the things are becoming even more complicated. For now the easiest and the most reliable way to use C++ libraries from another language is to compile it to…

> D can also use C and C++ libraries (including templates), and with gcc and llvm it covers pretty much all the same architectures/platforms as nim.

Thank you for the suggestion. It turns out to be correct. Obviously there is a huge amount of progress since the last times I had been looking at D, before more than 7 years. (https://dlang.org/spec/cpp_interface.html) Still the D way looks to me more inconvenient by requiring you to include the class internals into the D binding. Example from the D manual:

  extern(C++):
  struct Foo(T)
  {
    private:
    T field;

    public:
    @disable this();
    T get();
    void set(T t);
  }
Nim requires you only to mention the name of the class (template) and the public part of the interface which you actually going to use. Example from the Nim manual (https://nim-lang.org/docs/manual.html#importjs-pragma-import...).

  type StdMap {.importcpp: "std::map", header: "".} [K, V] = object
  proc `[]=`[K, V](this: var StdMap[K, V]; key: K; val: V) {.importcpp: "#[#] = #", header: "".}

  var x: StdMap[cint, cdouble]
  x[6] = 91.4
> with gcc and llvm it covers pretty much all the same architectures/platforms as nim

I am not sure whether they cover some really old platforms. By compiling to C you can target pretty much every platform which have a C89 standard conforming compiler.

A day ago I asked in the Dlang forum (https://forum.dlang.org/post/nmwinrjavfumvxffptxy@forum.dlan...) whether it is possible to develop in D for video game consoles, not only current generation which Remedy Games do for example, but also a few generations back. It turns out to not be completely clear, because maybe no one has tried it, but it was suggested that even if possible, probably it would require a considerable amount of tinkering. I don't know whether someone tried this in Nim but it seems to me, that by compiling to C89 or C++98, it would not be much an issue for every platform with a conforming compiler for these languages.

Re: My Vision of D’s Future

#209
post #129

Earlier quoted context omitted.

Java has the same now (since Java 9 I think).

So you're saying it's as simple as: java build ./app/ ./app That's impressive if true as last I worked with Java it was a mess

Not quite. You can run `java Foo.java` and it will compile and execute the class file (and remove it when done).

Re: My Vision of D’s Future

#210

I didn't submit the link but I did write the blog post. AMA!

Is there any impetus in the community towards embedded development? By embedded I mean natively on microcontrollers, even if you were limited to 32 bit ARM platforms?

As a portion of our work targets micros, all of our code needs to be written in a language that supports micros so that we can share code. There is impetus to move on from C, but Rust is the first and only viable replacement candidate because of this.

Post reply on HN