Guitar and piano.
Yes, that's how I think too; it would be a shame. However, it's becoming more frustrating as another issue I have with D has sprung. These obstructions only get in the way. It's as if my mind starts to leak 'cause of it and makes me forget even simple things. I'm seriously starting to wonder what the hell's going on with all the stuff I've learned. As far as I'm concerned, it's correct so maybe it's the compiler...? If anyone's interested, here's some simple D code (though I will get help elsewhere, since this forum is not for D):
The output is most odd. It simple doesn't run as one would expect it to.Code:import std.c.stdio; import std.random; import std.stdio; const DONE = 0; int guess; int randomgen; char[] username; char yesorno; void guessing_game(){ do{ printf("\n\nGuess the number between 1 and 100: "); scanf("%i", &guess); if (guess > randomgen){ printf("Lower..."); } if (guess < randomgen){ printf("Higher..."); } } while (guess != randomgen) printf("\n\nYou guessed the number!"); } int main(){ randomgen = (rand() % 100) + 1; printf("\n\nHello there. What is your name? "); readln(username); printf("\n\nAlright, %s, we are going to play a little guessing game.\n", &username); printf("Proceed (Y/N)? "); scanf(&yesorno); if (yesorno == 'y'){ guessing_game(); } else{ goto END; } END: return DONE; }
I've gotten a bit further installing Derelict. It seems I had to install YET another piece of software. Installing DAllegro (Allegro for D) proves to be somewhat easier. Nevertheless it is a nuisance which, together with other errors, slightly tempts to abandon D for C or Pascal.
Oh, and Jordan: the number 83 reminds me of a sad past memory. I use it as a username, but that's pretty much it. I don't wish to speak of it further. Regrettable, but it must be so.
I would love to help you out, but I really have no experience in D, in fact, I don't think anyone in here, beside you, has experience in D. I will however give it another go...
This is more regarding the particular code you showed: how come you're using the C-library for output, and not the D-library? You're mixing C with D; C for output (printf) and D for input (readln). Not that it will solve anything, but I think you should stick to the D-output-functions as well; and if you do, then you don't have to import std.c.stdio.
Which compiler are you using? There's two major implementations: DMD and GDC. I guess you're using the former, right? You should maybe give GDC a try. DMD is the official one by the creator of D, yes, but GDC supports almost all of the features, and is also pretty cross-platform compared to DMD. Tango does officially support GDC, as well as DMD, and the installation process looks fairly easy. You can find their document on installation of GDC and Tango right here. You can also find nice installation-guides on GDC, like this one and this one.
Good luck, and I really hope you solve your problems!
The reason for that is that when using D's 'writefln' and 'readln' I got slightly confused as their outcome was not exactly what I expected. I also did not find any quick information on it as to why. The information I did find hardly mentioned 'readln' but did mention the old-fashioned 'scanf'. When I used C's 'printf' and 'scanf' at least I knew what I was doing (at least I thought so, as it seems D behaves rather oddly with me or I made errors).
I've been using GDC (installed through a package manager) since I used GCC before for C. I installed DMD 2.xxx, though, and the odd results were there too.Which compiler are you using? There's two major implementations: DMD and GDC. I guess you're using the former, right? You should maybe give GDC a try. DMD is the official one by the creator of D, yes, but GDC supports almost all of the features, and is also pretty cross-platform compared to DMD. Tango does officially support GDC, as well as DMD, and the installation process looks fairly easy. You can find their document on installation of GDC and Tango right here. You can also find nice installation-guides on GDC, like this one and this one.
Now I have removed GDC (which was probably supporting, more or less, what DMD 2.xxx has (which is unstable and experimental), and am attempting to install DMD 1.030 (which is the latest stable version), which proves to be a nuisance as there is no easy .deb install file. Nevertheless, I must go through with this since I don't want to use C nor Pascal.
And thanks for the links, hehe. I might just check out Tango after all if I can get DMD 1.030 working.
It took me a while to find some decent information as well, but I ended up finding a D documentation. It includes both tutorials, theory, and of course a description on the functions of the different libraries. I was however still not able to find anything about "readln," so I guess it isn't complete.Originally Posted by LXXXIII
You can find it here: Docwiki.
The official packages of DMD are indeed not very smart. You can use automagical scripts for some of the installation-process, but you'll also have to do a lot manually too. They should choose only one of the methods, and not mix them. The current process makes it confusing.Originally Posted by LXXXIII
That sounds good! Let me know if you get it up running or not.Originally Posted by LXXXIII
Yeah, that page is pretty much incomplete. If a language lacks proper documentation, it becomes a nuisance to some. I don't know how much I've spent searching, but it was probably a lot.
I think installations should always be made as easy as possible. For Windows they should simply have installers, and for Linux as well. They only have a .deb file for 2.xxx but not 1.xxx. It's as if they prefer you use the unstable version and use you as a guinea pig.
I've got it running, though. If you're interested, I found a site which has (old, but not so old) .deb files: Debian D Packages - Release 3 | PaloÅŸ::Code.Blog()
But even after having it all installed, I still face the same vague troubles (of getting unexpected program behaviour, lack of information, lack of proper explanations, etc.) up to a point I have no enthusiasm to learn D. In fact, I've been totally put off imperative programming. I've started to hate C, C++, and D. Even Pascal and Python don't attract me, so I've decided to just let it go. I will simply uninstall everything related to D and MAYBE return to it when it has matured into a fully functional standard with much support.
On another note, maybe not at all.
I've decided to pick up functional programming with Haskell. It's been a while since I've seen anything like it (as it looks almost alien compared to C-like code), but writing a function is a LOT faster and seems more... logical and mathematical, more to the point. Seeing Haskell code, raeding about it, and then thinking of how I'd do the same in C makes me think why the hell am I, and others, so attached to the way of imperative programming? Certainly, it makes much sense, especially OOP, but what the hell...? Seeing C-like code now pisses me off
And while functional programming is odd compared to imperative, it can easily make as much sense. They say that Pascal is a good teaching language because it's so clear (and it is), but since mathematics is a standard thing in education, I think functional programming (in Haskell) is even better. I have been "converted". Too bad the online information I've found is just as littered with showing off the language rather than teaching programming skills WITH the language.
Uh, changes.
I see your point with D. Just the little time I've spent with it, while trying to help you has been enough to scare me. I remember back when it was going to be released, and everybody were talking about how much it will contribute to the programming-business. It is first now that I get to know it better, and it is truly a disappointment, and I realize that all this talk has not been worthy for D (but I'm no expert.) Hopefully they will keep working on it, and it may eventually become a fine language (it will probably take some time, taken in consideration that it has been on the market for so long, and it still need so much work.)Originally Posted by LXXXIII
I'm still a big fan of imperative programming, especially with C, so I won't comment on your last statement.
You should consider Scheme, Common Lisp or some other LISP-dialect.Originally Posted by LXXXIII
I try and vary my repertoire as much as possible - jazz, romantic, baroque...I'm gonna take Grade 8 in a couple of years, maybe less... done Grade 7, but my teacher wants me to 'mature' a bit more (ie start practisising!).
I also played the descant/treble recorder up to grade 6, doing grade 5/6 for bassoon, and I dabble around in drums and the ukelele.![]()
Yes. What I find negative about it is that even if it has been available for many a year, it is not yet "complete" or standardized. For instance, the two competing libraries Phobos (standard) and Tango (non-standard) make it more difficult for the newcomer to enjoy D. And furthermore there are so many tools available which, in a way, is good but it actually complicates the matter even more instead of facilitating it, together with related information (whether positive or negative). Much like the principle in war, all this division weakens D. It makes for a vulnerable entity which can only survive and grow powerful if it is united into one single being. I don't suspect a proper unification will ever occur.
Hehehe! Well, I think C is the lesser of two evilsI'm still a big fan of imperative programming, especially with C, so I won't comment on your last statement.![]()
C++ seems so complicated and bloated, while C, compared to it, seems compact and more efficient (which it obviously is), though the lack of OOP exists. I have more respect for a language like C than C++, as it is purer. Yes, as is Pascal, C is acceptable; C++ is like its evil bastardized form designed to torture human minds.
D is supposed to be the "better C/C++", and in a way it is, but in its current state, as I concur with you, it is a disappointment.
What I also find a disappointment is the fact that Pascal and Object Pascal (not to mention Modula and/or Oberon) are not as widespread as C and C++. It always raises a question in my mind: "Must man serve machine, or must machine serve man?" Ultimately, we serve ("maintain") machine so it is able to serve us, but I personally prefer it to be as human as possible. C/C++ syntax does not reflect this.
Why is that?You should consider Scheme, Common Lisp or some other LISP-dialect.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks