Jump to page: 1 2
Thread overview
Some impressions/notes from a new D programmer
Feb 12, 2020
mark
Feb 12, 2020
Dennis
Feb 12, 2020
mark
Feb 12, 2020
Anonymouse
Feb 12, 2020
user1234
Feb 12, 2020
Adam D. Ruppe
Feb 12, 2020
mark
Feb 12, 2020
Adam D. Ruppe
Feb 12, 2020
mark
Feb 12, 2020
Adam D. Ruppe
Feb 12, 2020
Sebastiaan Koppe
Feb 12, 2020
bachmeier
Feb 12, 2020
Jan Hönig
February 12, 2020
I've been learning D for a few weeks now.

I'm an experienced programmer in other languages (esp. Python, but also Rust and C++).

Here're some *early* impressions and notes.

D Tour

I found the D Tour, esp. "D's Basics" to be very helpful. Each part is short and in most cases understandable. Being able to run and edit the code is a real help for learning.

D Playground

The D playground https://run.dlang.io/ is very useful for trying out snippets and generally learning, so I use it a lot. (I still haven't worked out how to save a URL to my code though.)

Library Reference Documentation

The Library Reference documentation seems to be a mixed bag. Often I've found a good overview at the start, but then few or no examples in the docs for classes and methods (see e.g., https://dlang.org/phobos/std_zip.html#.ZipArchive).

I don't find the presentation of the member properties and methods very easy to read, but the worst aspect is the lack of examples.

Standard Library

The library itself "feels" a bit incomplete, which is surprising given how long D's been around. To give just two examples:

The lack of set and B-tree types is disappointing (esp. considering that the much younger Rust has them). I'm using rbtree for sets but that imposes a requirement that my items support < (rather than the == or hash I'd expect for a set).

The fact that the return value of std.file.getAttributes() means completely different things on POSIX and Windows. That's fair enough, but there ought to be a platform-neutral equivalent for those writing cross-platform applications that returned, say, a struct or tuple with the common subset of attributes normalised. (And if there is such a function, why isn't it cross-referenced.) There seems to be a curious mixture of functions which are POSIX- or Windows-specific and those which are platform neutral.

The D Language

The D language seems to be a "kitchen sink" (i.e., has everything) like C++, Rust, (and nowadays, Python). This makes it big and a *lot* to learn. However, I managed to create a little library that used template types (with some help from this forum), and I _understand_ the templates. This is a huge improvement over C++ or Rust. And to my surprise, so far my D programs have about the same line counts as the Python versions.

Also, I've found building much easier than C++. However, dub doesn't seem to be competitive with Rust's cargo. Getting fast statically built (no dependency) executables is really nice.

GUI Programming

I've tried a number of D GUI libraries, and all bar one have been problematic.

To my surprise GtkD was easy to install on both Linux and Windows and getting "hello world" to build and run was fairly easy. The documentation doesn't seem that easy to use, but I'll start with Ron Tarrant's https://gtkdcoding.com/ and see how I get on from there.

D Books

I find Ali Çehreli's book (http://ddili.org/ders/d.en/index.html) more suited to complete beginners, but I am skim reading it and finding it useful here and there.

The main books I'm reading are Mike Parker's Learning D and Adam Ruppe's D Cookbook, both of which I think are pretty good. (However, I hope both will produce more up-to-date and improved second editions with a better publisher.)

Learn D Forum

People on this forum have always provided polite and helpful answers. This is a very important intangible benefit of the language.

Conclusion

My hope was that D would offer a sweet spot between Python's ease and speed of development and Rust's performance. And so far this looks like being the case.
February 12, 2020
Thanks for your perspective. Just a few things are unclear to me:

On Wednesday, 12 February 2020 at 10:39:06 UTC, mark wrote:
> I don't find the presentation of the member properties and methods very easy to read

Can you elaborate a bit on this?

> The lack of set and B-tree types is disappointing (esp. considering that the much younger Rust has them). I'm using rbtree for sets but that imposes a requirement that my items support < (rather than the == or hash I'd expect for a set).

This confuses me. So there is std.container.rbtree, but you don't like that the element type needs to have an order defined? How can Rust do binary search in a tree that has no order?
If you are looking for a hashset, you can use an associative array for that.

> However, dub doesn't seem to be competitive with Rust's cargo. Getting fast statically built (no dependency) executables is really nice.

I've heard good things about cargo, but haven't used it myself yet.
Do you have a specific thing dub can improve the most on?

February 12, 2020
On Wednesday, 12 February 2020 at 11:46:02 UTC, Dennis wrote:
> Thanks for your perspective. Just a few things are unclear to me:
>
> On Wednesday, 12 February 2020 at 10:39:06 UTC, mark wrote:
>> I don't find the presentation of the member properties and methods very easy to read
>
> Can you elaborate a bit on this?

Maybe I'm just used to the Python docs, but I find them a lot easier to read.

>> The lack of set and B-tree types is disappointing (esp. considering that the much younger Rust has them). I'm using rbtree for sets but that imposes a requirement that my items support < (rather than the == or hash I'd expect for a set).
>
> This confuses me. So there is std.container.rbtree, but you don't like that the element type needs to have an order defined? How can Rust do binary search in a tree that has no order?
> If you are looking for a hashset, you can use an associative array for that.

Naturally a tree needs <. But I want a set and since D doesn't have one I can either use an AA or an rbtree and I was advised that an rbtree is better for this purpose.

>> However, dub doesn't seem to be competitive with Rust's cargo. Getting fast statically built (no dependency) executables is really nice.
>
> I've heard good things about cargo, but haven't used it myself yet.
> Do you have a specific thing dub can improve the most on?

Some cargo packages are applications. If I do 'cargo install someapp' it will be installed in $HOME/.cargo/bin. So by simply adding that to my PATH, I can easily use all installed rust apps. But dub doesn't appear to have an equivalent of this.

February 12, 2020
On Wednesday, 12 February 2020 at 10:39:06 UTC, mark wrote:
> Library Reference Documentation

Have you seen my fork?

http://dpldocs.info/experimental-docs/std.zip.ZipArchive.html

for example

> The documentation doesn't seem that easy to use

I generated docs for this too

http://gtk-d.dpldocs.info/gtk.AboutDialog.AboutDialog.html

though since it is generated from C source ultimately the samples there are still C! But you can navigate members somewhat well.
February 12, 2020
On Wednesday, 12 February 2020 at 13:36:13 UTC, mark wrote:
> Some cargo packages are applications. If I do 'cargo install someapp' it will be installed in $HOME/.cargo/bin. So by simply adding that to my PATH, I can easily use all installed rust apps. But dub doesn't appear to have an equivalent of this.

There is 'dub run someapp', which is good enough for some cases, like digger[1]. But no 'dub install someapp', no.

Maybe there are some hard design decisions again $HOME/.dub/bin, unsure. It might be difficult to globally pull off if programs expect the binary to be placed in the source tree (for resources).

[1]: https://github.com/CyberShadow/Digger
February 12, 2020
On Wednesday, 12 February 2020 at 14:15:40 UTC, Adam D. Ruppe wrote:
> On Wednesday, 12 February 2020 at 10:39:06 UTC, mark wrote:
>> Library Reference Documentation
>
> Have you seen my fork?
>
> http://dpldocs.info/experimental-docs/std.zip.ZipArchive.html

Yours is *much* clearer.

However, if you compare:
http://dpldocs.info/experimental-docs/std.zip.html vs
https://dlang.org/phobos/std_zip.html

Yours rolls the two examples into one and doesn't show the Standards or Usage sections. But the official page doesn't have the Bugs section.

I also think you split into more HTML files which I prefer.
OTOH yours doesn't have the search box. Given how new I am to D, I really need to be able to search.

> for example
>
>> The documentation doesn't seem that easy to use
>
> I generated docs for this too
>
> http://gtk-d.dpldocs.info/gtk.AboutDialog.AboutDialog.html
>
> though since it is generated from C source ultimately the samples there are still C! But you can navigate members somewhat well.

I hadn't seen this and it does looks easier to navigate. I've bookmarked it. Thanks.

February 12, 2020
On Wednesday, 12 February 2020 at 15:28:57 UTC, Anonymouse wrote:
> Maybe there are some hard design decisions again $HOME/.dub/bin, unsure. It might be difficult to globally pull off if programs expect the binary to be placed in the source tree (for resources).
>
> [1]: https://github.com/CyberShadow/Digger

It could just create some shortcuts in ~/bin. AFAIK this special folder got automatically added to the $PATH in RH and deb distributions. The less obvious solution is for Windows systems.
February 12, 2020
On Wednesday, 12 February 2020 at 10:39:06 UTC, mark wrote:

> Library Reference Documentation
>
> The Library Reference documentation seems to be a mixed bag. Often I've found a good overview at the start, but then few or no examples in the docs for classes and methods (see e.g., https://dlang.org/phobos/std_zip.html#.ZipArchive).
>
> I don't find the presentation of the member properties and methods very easy to read, but the worst aspect is the lack of examples.

It's a bug if something isn't properly documented, whatever the flaw may be. It's gotten a lot better in the time that I've been using D, but there are still a few rough spots.

My strategy has been to ask for an example in the forum. I then click "Improve this page" in the upper right corner and it's a simple process to create a PR with the example added. Most of the documentation PRs I've created have been merged within a fwe hours. If you don't want to do that, you can create an issue in Bugzilla, with a detailed explanation of what you were doing and what the documentation should show instead.

It would be nice for this to already be done, and while it's generally good by the standards of programming languages, there are still some weak spots. Anyone can help fix them. In some cases when I've reported missing documentation, there actually *was* documentation but it wasn't getting added to the website for some reason. Nobody will know until it's pointed out. And nobody's going to shout at you for filing too many documentation bugs or creating too many PRs to fix documentation bugs.
February 12, 2020
On Wednesday, 12 February 2020 at 10:39:06 UTC, mark wrote:
> I've been learning D for a few weeks now.
>
> ...

I made exactly the same experience in December.
February 12, 2020
On Wednesday, 12 February 2020 at 15:52:35 UTC, mark wrote:
> Yours rolls the two examples into one and doesn't show the Standards or Usage sections.

Weird, that's a legit bug in there. I'll fix them.

> I also think you split into more HTML files which I prefer.
> OTOH yours doesn't have the search box. Given how new I am to D, I really need to be able to search.

The search is in the upper right.... unless you resize the window, then it disappears. lol another bug, how did I not notice that before?

well I'll fix those in a little bit.
« First   ‹ Prev
1 2