Live data from Hacker News

D as a Better C

dlang.org

181–190 of 193 posts

Re: D as a Better C

#181
post #11

Earlier quoted context omitted.

The only difference I see is in marketing. D could be marketed as a better Python and it has enough features to qualify.

There are many D programmers who use D as a fast Python.

what do people mean by 'a fast Python' in this context, when the language syntax and features look nothing like Python?

Re: D as a Better C

#182

Earlier quoted context omitted.

There are many D programmers who use D as a fast Python.

what do people mean by 'a fast Python' in this context, when the language syntax and features look nothing like Python?

Walter and others who know D much better can answer better, but I'll add my 2c, based on what I've read and some use I've done of D:

- The Wikipedia article about D says that Python was one of the languages that influenced it:

https://en.wikipedia.org/wiki/D_(programming_language)

- After programming in D for a while, I noticed that a) it felt comfortable to program in it, and b) that it did feel a bit like Python, in the sense that, once you've learned some of the basic features [1] and are writing small but non-trivial programs, the language does not seem to get much in your way, as they say. Also there are a few things where its library functions are a bit like Python, like using File(filename) to open a file and get a File object to operate on. Not exactly similar syntax (though there may be some of that too, if you overlook the superficial things like braces instead of indentation to delimit blocks of code), but more of a "feel" - maybe it is the way some of the functions are designed, at a somewhat higher level of abstraction than C. Also, both Python and D were influenced by C.

Incidentally, Python seems to have both influenced and been influenced by many languages (14 and 11 respectively):

https://en.wikipedia.org/wiki/Python_(programming_language)

[1] I've not tried many of the advanced language features yet (and D has many language features, including some relatively advanced ones), but I found it somewhat easy to grasp even basic use of function templates. But you can do a lot even with the basic language features and standard library.

Re: D as a Better C

#183

Earlier quoted context omitted.

I have tried Rust in the past, though not on this particular hobby project (my Clojure interpreter). I found it hard to get into, and I've gotten into a lot of languages in my time-- some of which are considered challenging (e.g. Haskell). With Rust, I always felt I spent too much time wrestling with it, and not enough time being productive. I imagine that you hit a threshold at some point and that begins to change.…

Rust's documentation is very well written. The authors have put in great effort to make things clear. Granted Rust has some paradigms and constructs which are not easy to learn, I found it rather exciting. I think it has future scope. Wonder whats happening with Redox. I hope Rust adds more libraries, especially network related, since the networked world is increasingly looking like a distributed OS of sort. Browsers…

> Wonder whats happening with Redox.

They've been involved in Google Summer of Code, and so have had lots of status update posts lately, here's the latest: https://redox-os.org/news/gsoc-self-hosting-final/

> Rust should move away from C standard library, if possible.

It's not always possible, but on systems where it is, there's some ability to do so, see https://github.com/japaric/steed

Re: D as a Better C

#184
post #130

Earlier quoted context omitted.

[EDIT: I didn't down-vote you, and I appreciate the question.] Simplicity is not the same as familiarity. It's not the same as a small feature-set, either. Gratuitous Rich Hickey reference for what I mean by simple[1]. So most languages aren't simple by that definition, but I'd say that Go's inconsistencies prevent it from being what I call simple. Some examples: Instead of having a general mechanism for describing d…

What is "vendoring"?

Vendoring is when you include a copy of your dependencies inside of your project.

Re: D as a Better C

#185
post #159

Earlier quoted context omitted.

If you have an "echo" primitive/function, and "out of the box unicode support", then respecting the host OS codepage/output encoding by default is the sane thing to do (as indicated in the bug linked by the sibling comment ("just use the win32 api"). It's not that nim can't output wide characters from a utf8 source, it's just that it's not obvious how to do it in a standard way - one might thing that utf8 unicode "he…

Nim is not a Win32 runtime. It outputs strings to stdout. Any sane OS would do the right thing in 2017.

I should perhaps clarify that "just use the win32 api" refers to on Windows. Just as one might use syscall 4/write() on Linux, if one doesn't want to/can use libc printf.

See also, for example:

https://stackoverflow.com/questions/15528359/printing-utf-8-...

https://stackoverflow.com/questions/26106647/c11-unicode-sup...

http://www.cprogramming.com/tutorial/unicode.html

Note; I'm not convinced using utf8 internally is a great idea - especially for a "beginner friendly" language. Playing with anything from palindromes to revise strings and character/grapheme counts and

  "d o u b l e  s p a c i n g"
strings can be fun learning exercises - that might be easier with a 32-bit (or even 64 bit) representation.

But no matter how you look at it, there's no such thing as "simple" handling of international text.

Re: D as a Better C

#186
post #112

Now we need another flag to enable a better Java mode. By default D is in better C++ mode.

How about betterC# instead? Given that C++/CLR is a thing, I imagine that it would be possible to get D working on it. JVM is a bit more limited in what it allows vs. CLR. For instance, C# has the unsafe keyword that allows pointer arithmetic, which would correspond to @system in D. @safe D would correspond to the normal C# behavior on that front. Probably a lot of work though and I'm not sure why anybody would bothe…

D already is and has been (better C#) when taken as a language. No need for a command line flag.

Re: D as a Better C

#187

I have tried D, loved the language but I feel the ecosystem and environment issues need to be addressed asap. Here are a few inputs (1) setting up env different operating systems eg GNU/linux variants. Compilers ldc, etc are not really easy to setup on all systems. (2) Memory usage during compile can get out of control resulting in mid-build crashes if sufficient memory is not available. (3) Setting up of a simple ht…

High memory usage could be cursed by Ctfe code. There is an existing project to improve the Ctfe interpreter, called newctfe.

Re: D as a Better C

#188

Earlier quoted context omitted.

Rust's documentation is very well written. The authors have put in great effort to make things clear. Granted Rust has some paradigms and constructs which are not easy to learn, I found it rather exciting. I think it has future scope. Wonder whats happening with Redox. I hope Rust adds more libraries, especially network related, since the networked world is increasingly looking like a distributed OS of sort. Browsers…

> Wonder whats happening with Redox. They've been involved in Google Summer of Code, and so have had lots of status update posts lately, here's the latest: https://redox-os.org/news/gsoc-self-hosting-final/ > Rust should move away from C standard library, if possible. It's not always possible, but on systems where it is, there's some ability to do so, see https://github.com/japaric/steed

Thanks Steve.

>It's not always possible, but on systems where it is, there's some ability to do so, see https://github.com/japaric/steed

Doesn't linking to it make a Rust program "unsafe", in the Rust sense? Or my understanding is probably not correct.

Re: D as a Better C

#189

Earlier quoted context omitted.

> Wonder whats happening with Redox. They've been involved in Google Summer of Code, and so have had lots of status update posts lately, here's the latest: https://redox-os.org/news/gsoc-self-hosting-final/ > Rust should move away from C standard library, if possible. It's not always possible, but on systems where it is, there's some ability to do so, see https://github.com/japaric/steed

Thanks Steve. >It's not always possible, but on systems where it is, there's some ability to do so, see https://github.com/japaric/steed Doesn't linking to it make a Rust program "unsafe", in the Rust sense? Or my understanding is probably not correct.

Using unsafe inside of safe is totally fine. See https://doc.rust-lang.org/nomicon/safe-unsafe-meaning.html for more.

Re: D as a Better C

#190

Earlier quoted context omitted.

Thanks Steve. >It's not always possible, but on systems where it is, there's some ability to do so, see https://github.com/japaric/steed Doesn't linking to it make a Rust program "unsafe", in the Rust sense? Or my understanding is probably not correct.

Using unsafe inside of safe is totally fine. See https://doc.rust-lang.org/nomicon/safe-unsafe-meaning.html for more.

[deleted]
Post reply on HN