I'm bored...

Pages: 12
closed account (S6k9GNh0)
Gimme something to code or something. OpenGL is "too hard". T.T
How about Project Euler problems in D?

computerquip wrote:
From now on, because of the lack of support for D and the really poor arguments against it, I'm no longer using C++. D is currently my mainstream language.

because of the lack of support for D and the really poor arguments against it


Wait, I thought lack of support was a good argument against it :P
closed account (S6k9GNh0)
D is my mainstream language but I still won't use it for library development (for various reasons, including forced garbage collection) and I can't replace current C++ libraries that have been developed for years. I have made several things in D such as a Teamspeak Query Protocol bot but the underlying library was made in C++ with ASIO and the parser in C with Bison/Flex then interfaced in a uniform C API which I then interface to my D bot.

I have been working on OpenGL with D but unfortunately, I'm not to successful at the moment (because I don't understand how OpenGL works entirely) and have been too busy to dedicate any real time to make something significant from scratch anymore.
Last edited on
I'm not combative, but I don't see what's wrong with garbage collection. Is there a significant performance penalty you wish to avoid?

All I know is that they deprecated delete and since then I've been using clear() with the same effect, wherever needed. (I'm still only scratching the surface of D.)

I have been working on OpenGL with D but unfortunately, I'm not to successful at the moment (because I don't understand how OpenGL works entirely) and have been too busy to dedicate any real time to make something significant from scratch anymore.

When you have time, I think this link may help in understanding OpenGL:
http://www.songho.ca/opengl/index.html
Can anyone explain the syntax of D. Is it a step up of C++, what is the difference?
D has the syntax of several languages. That is one thing that made me avoid it.
@ Script Coder: check PM.

@ BHXSpecter: that's an excellent reason to avoid any language, but now I'm curious what are the other things?
closed account (1yR4jE8b)
2 different, incompatible standard libraries.
I too am disappointed by the presence of Tango alongside Phobos in the official language distro.

Good thing that would never happen in C++.
closed account (S6k9GNh0)
Tango for D2 doesn't exist. D1 has been deprecated. Phobos *is* the standard library.
D takes syntax from multiple languages indeed but it doesn't force you to use a certain syntax.

For instance, here's a code snippet using OpenAL through bindings I made to resemble the C counterpart:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import std.c.stdio;
import std.c.string;
import AL.al;
import AL.alc;

int main()
{
    const(char)* it = alcGetString(null, ALC_DEVICE_SPECIFIER);

    while (*it != '\0') {
        int n = strlen(it) + 1;
        printf("%i ", n);
        printf("%s ", it);
        printf("%x %x %x\n", *(it+n-2), *(it+n-1), *(it+n));  
        it += n;
    }
    return 0;
}

As you can see, there's very little difference between the C counterpart and this. However, there are a lot more ways I could create this to be more D savvy and so on.

By default, you cannot use Phobos without using its garbage collector. Thus, if you wish to do something low level such as create an efficient driver, you simply can't without a standard library implementation other than what's provided or making your own i.e. it forces GC onto you. There are ways you can avoid the GC and use phobos but it's super restrictive and error bound. I have no issues with a GC but in a library, I'd like my users to decide what they want. The D language itself doesn't have a lot of restrictions, most of the issues are really in its implementations.


This isn't the purpose of this topic anyways. If you wish to discuss this, I would go onto their mailing lists to see the changes between D1 and D2, and to see what inspired some of the syntax (most of which is answered by their FAQ).
Last edited on
Catfish2 wrote:
@ BHXSpecter: that's an excellent reason to avoid any language, but now I'm curious what are the other things?

When I looked into D I read that it was influenced by C, C++, C#, Java, Ruby, Python, Eiffel and as such its syntax is similar in respects.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/rdmd
// Computes average line length for standard input.
import std.stdio;

void main() {
    ulong lines = 0;
    double sumLength = 0;
    foreach (line; stdin.byLine()) {
        ++lines;
        sumLength += line.length;
    }
    writeln("Average line length: ",
        lines ? sumLength / lines : 0);
}


Other reason is I don't know C#, Java, Ruby, Python, or Eiffel. Don't know any commercial apps using D yet. Will consider D if I ever learn the other languages that influenced D's creation. I've only learned C++ and PHP. Keep saying I'll learn C#, Java, Ruby, and Python, but not had the motivation to do so.
closed account (S6k9GNh0)
I dont really get why taking the "good" from other languages and trying to filter out the bad then placing that into a single language is bad. Its not like they took syntax from the other languages verbatim. Most languages today have very large amounts of languages that they derive from, I don't see why that should be counted against any language.
If you are going to take the "good" from other languages then take time to give your language its own syntax. I don't know the languages like I said, but I have done a few tutorials online and at least done the customary Hello World app in each. I find it utterly frustrating to sit down and use a language where I have to remind myself "Okay, I need this '#!/usr/bin/rdmd' like I'm doing python/perl/ruby. Then I need 'import std.stdio;' like I'm doing C# or Java. I need void main like in C. writeln like in C#. etc. etc." I'm sure D is probably great and fun to learn, but is on my low list of languages I am in no hurry to learn because of how the syntax is.
If you are going to take the "good" from other languages then take time to give your language its own syntax.

Hear that, Stroustrup?

BHXSpecter, I believe you do not realize the benefits of familiarity in a programming language. A language is meant to be understandable, not pure, and in my personal experience the learning curve of D is not very steep if you have some C++ skills at the beginning.

Now, you could just say you don't like the language and that's fine!
But don't say you are intimidated by its syntax, because in the case of D, and especially if you're already familiar with C++, that's just laughable.
"Okay, I need this '#!/usr/bin/rdmd' like I'm doing python/perl/ruby. Then I need 'import std.stdio;' like I'm doing C# or Java. I need void main like in C. writeln like in C#. etc. etc."


Yeah, I don't really agree with this either. It's not like those are incredibly different or anything. If they were mixing something like Java with BASIC and random assembly then I could see your point.
Familiarity is fine, I understand that completely, but familiarity from multiple languages add to possible confusion. I'm not intimidated by its syntax, but it is the syntax as to why I don't like it. When I was trying to learn D I found myself wanting to go from D's mixed syntax to the syntax of just one of the languages it pulls from. One thing I kept doing was with writeln(), I kept wanting to do Console.Writeln() instead, but wouldn't catch my goofs til after I had done the whole file.

Yeah, I don't really agree with this either. It's not like those are incredibly different or anything. If they were mixing something like Java with BASIC and random assembly then I could see your point.


May just be me, but because I've dabbled in all the languages it pulls from I find myself changing from D to the other languages or trying to do things from one language in D and remind myself I'm doing D and not Java or Python or C# etc.
Last edited on by closed account z6A9GNh0
closed account (S6k9GNh0)
Its main derivatives is C++ and Java. I don't see how the function "writeln" reminds you of another language just because of its name despite having a syntax similar to C++. What else would you like them to call it? What example of syntax reminds you this much of another language anymore than some other language? This feels like saying, "I don't use C++ because it reminds me of C".
Last edited on
Writeln that I'm talking about is C# not C++. It's not that it reminds me of the other language, it is that because I have used the other languages I kept screwing up and using the other languages variants instead of D. I've screwed up and done perl/ruby/ pythons #! line at points doing D, I've screwed up and done the C# writeln calls, and cringe when I see void main(). As for the "I don't use C++ because it reminds me of C", bare in mind there are actually programmers that refuse to learn C after C++ or vice versa for just such reasons or that C++ is harder than C, even seen programmers refuse to learn C before or after C++ because they claim it teaches poor programming habits. D's syntax is so familiar to me that I keep using the language that it is pulled from, which gets annoying fast, and that has tainted my taste for D.
closed account (S6k9GNh0)
Yet, especially on these forums, we see people use horrid C concepts in C++ all of the time. I don't believe this is the fault of C++ or the languages it derives from, nor does it remove power from the language.
Last edited on
Pages: 12