Live data from Hacker News

Programming in D: Tutorial and Reference

ddili.org

91–100 of 134 posts

Re: Programming in D: Tutorial and Reference

#91
post #86

I constantly feel like inferior languages are picked up, while superior languages are discarded. It's almost as if the universe had a law: "inferior technology is always preferred no matter how hard you seethe". Examples: * Python preferred over Ruby * TypeScript preferred over Dart or even JavaScript (which is fine and, as a bonus, doesn't require compilation step like TS) * Go is preferred over Crystal and D. While…

Having coffee almost 30 years in c++ I really good tired of the complexity of it. Some of the newer complexity being workarounds for (in retrospect) poor decisions made decades ago. Build system situation never helped, and I still despise cmake. When D came out I was interested but garbage collection immediately turned me off, in my opinion the boost shared pointers (later adopted into the standard) solved and shut t…

> When D came out I was interested but garbage collection immediately turned me off,

Only a small amount of D uses the garbage collector. It's quite easy to write D code that doesn't use it.

> in my opinion the boost shared pointers (later adopted into the standard) solved and shut the door on memory leaks as a serious issue.

Reference counting is slow and memory intensive.

Re: Programming in D: Tutorial and Reference

#92

Earlier quoted context omitted.

What essential features are missing for you?

For game development? I imagine having to use only structs but not classes would be something that forces a "non idiomatic D" experience. Dynamic arrays sound like something that's very useful for a game. I don't know, there are plenty of features that are incompatible with better C that makes D, D. Generally speaking, garbage collection would be the biggest in my opinion.

You can still use classes in BetterC - you just have to allocate them yourself. D recently acquired "placement new" which makes that more convenient.

Re: Programming in D: Tutorial and Reference

#93

Really wanted to like Dlang but I just did not have a good time with it. One of my projects has a really simple server written in nodejs that's basically (in terms of complexity) just an auth'd chatroom, and I wanted to switch it from using raw tcp sockets to websockets. And since the server is so simple, why not refactor it to another language and see if there's no some performance gains from that? I ended up doing…

How did you build the rust project? The docs say: > Most Rust programmers don't invoke rustc directly, but instead do it through Cargo. It's all in service of rustc though! If you want to see how Cargo calls rustc, you can $ cargo build --verbose

Sure, but everything seems to point users towards using the compiler, not the package manager. For example:

- The tour guide first recommends dmd (https://tour.dlang.org/tour/en/welcome/run-d-program-locally), though it does mention dub at the bottom

- Clicking "Documentation -> Command-line Reference" takes you to dmd, with only the barest mention of dub

- Even this post, the "Programming in D" book, tells you to use dmd and doesn't mention dub at all.

Re: Programming in D: Tutorial and Reference

#94
post #54
post #43

Earlier quoted context omitted.

To a beginner who is used to ordinary imperative languages, that Ruby line is extremely difficult to understand. Is `.filter` a method or a property of `xs`? Is `{ |x| x.odd? }` an argument to a method or just a statement that comes after `xs.filter`? If it is passed to `.filter`, why does it not have parentheses around it but the `", "` passed to `join` does? This all makes sense to a person who knows the language a…

The Ruby syntax doesn't seem that different to many other languages. For example: xs.filter(x => x & 1).sort().join(", ") // JavaScript xs & filter odd & sort & map show & intercalate ", " -- Haskell Python seems to be the odd one out. Imo, its list comprehensions are confusing as hell to "newcomers". For example, when a list comprehension has multiple `for`s, what order are they nested in?

>Python seems to be the odd one out. Imo, its list comprehensions are confusing as hell to "newcomers". For example, when a list comprehension has multiple `for`s, what order are they nested in?

The order is mentioned right in the docs, for Python 3:

https://docs.python.org/3/tutorial/datastructures.html#list-...

>Note how the order of the for and if statements is the same in both these snippets.

And it is mentioned even more clearly in corresponding section in the Python 2 docs - last I checked, years ago,

Update: IOW, the nested list comprehension syntax is confusing only to newcomers or even experienced devs who are lazy or stupid enough to not read the docs for the language feature they want to use, before using it, IOW, "winging it", whether to try to seem cool or due to peer pressure or other reasons, all of which are stupid ones, even in the short term, because the cost is higher than the benefit in most cases.

Re: Programming in D: Tutorial and Reference

#95
post #94
post #54

Earlier quoted context omitted.

The Ruby syntax doesn't seem that different to many other languages. For example: xs.filter(x => x & 1).sort().join(", ") // JavaScript xs & filter odd & sort & map show & intercalate ", " -- Haskell Python seems to be the odd one out. Imo, its list comprehensions are confusing as hell to "newcomers". For example, when a list comprehension has multiple `for`s, what order are they nested in?

>Python seems to be the odd one out. Imo, its list comprehensions are confusing as hell to "newcomers". For example, when a list comprehension has multiple `for`s, what order are they nested in? The order is mentioned right in the docs, for Python 3: https://docs.python.org/3/tutorial/datastructures.html#list-... >Note how the order of the for and if statements is the same in both these snippets. And it is mentioned…

"RTFM" could excuse literally any syntax decision in any language.

The hostility in your response to "lazy or stupid" devs is really funny given what a bad response it is.

Re: Programming in D: Tutorial and Reference

#96

Earlier quoted context omitted.

Mike Shah has been using D for teaching software engineering at Northeastern University and Yale. Here is his DLang playlist: https://www.youtube.com/playlist?list=PLvv0ScY6vfd9Fso-3cB4C...

We have also been using D for computer graphics and game programming as of this year! :D

Lecture videos or notes?

Re: Programming in D: Tutorial and Reference

#97
post #95
post #94

Earlier quoted context omitted.

>Python seems to be the odd one out. Imo, its list comprehensions are confusing as hell to "newcomers". For example, when a list comprehension has multiple `for`s, what order are they nested in? The order is mentioned right in the docs, for Python 3: https://docs.python.org/3/tutorial/datastructures.html#list-... >Note how the order of the for and if statements is the same in both these snippets. And it is mentioned…

"RTFM" could excuse literally any syntax decision in any language. The hostility in your response to "lazy or stupid" devs is really funny given what a bad response it is.

[flagged]

Re: Programming in D: Tutorial and Reference

#98
post #74

Earlier quoted context omitted.

> ... confusing as hell to "newcomers". For example, when a list comprehension has multiple `for`s, what order are they nested in? I get that this is just a rhetorical question to make a point about newcomers, and I do agree it's not immediately obvious, but for the record: you can imagine any "if"s and "for"s in a list comprehension are nested statements in the same order. So, for example, this: l = [ y.foo() for x…

Yeah, I know, I know. But I imagine many people would mentally want to bracket [e for x in xs for y in ys] like [(e for x in xs) for y in ys] and thus conclude that y is the outer loop.

[flagged]

Re: Programming in D: Tutorial and Reference

#99

Really wanted to like Dlang but I just did not have a good time with it. One of my projects has a really simple server written in nodejs that's basically (in terms of complexity) just an auth'd chatroom, and I wanted to switch it from using raw tcp sockets to websockets. And since the server is so simple, why not refactor it to another language and see if there's no some performance gains from that? I ended up doing…

Hi there. I'm the serverino's author.

Could you please explain better what's wrong with it?

It could be useful to improve newcomers experience.

How did you choose serverino over other frameworks?

Post reply on HN