+ Reply to Thread
Page 2 of 4
FirstFirst 1 2 3 4 LastLast
Results 11 to 20 of 33

Thread: 'lo, and need some advice

  1. #11
    Newbie LXXXIII is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    13

    Re: 'lo, and need some advice

    Quote Originally Posted by Xav View Post
    Welcome to CodeCall! Which instrument(s) do you play?
    Guitar and piano.

    Quote Originally Posted by v0id View Post
    It would be a shame to avoid D just because you can't get the installation of certain libraries to work properly, and I think you feel the same. I think you should stick to D, as it is, like you say, the language which appeals to you the most.
    Where exactly are you failing to install Tango, and have you tried seeking help in their forum, if they have one? It might not be you who just can't get it to work; it may have an error.
    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):

    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;
    }
    The output is most odd. It simple doesn't run as one would expect it to.

    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.

  2. #12
    Retired v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light
    Join Date
    Apr 2007
    Posts
    2,942
    Blog Entries
    3

    Re: 'lo, and need some advice

    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!

  3. #13
    Newbie LXXXIII is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    13

    Re: 'lo, and need some advice

    Quote Originally Posted by v0id View Post
    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.
    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).

    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.
    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.

    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.

  4. #14
    Xav
    Xav is offline
    Code Slinger Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav's Avatar
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,217
    Blog Entries
    13

    Re: 'lo, and need some advice

    Quote Originally Posted by LXXXIII View Post
    Guitar and piano.
    Cool. I play the piano as well.

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

  5. #15
    Retired v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light
    Join Date
    Apr 2007
    Posts
    2,942
    Blog Entries
    3

    Re: 'lo, and need some advice

    Quote Originally Posted by LXXXIII
    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).
    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.

    You can find it here: Docwiki.

    Quote Originally Posted by LXXXIII
    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.
    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.

    Quote Originally Posted by LXXXIII
    I might just check out Tango after all if I can get DMD 1.030 working.
    That sounds good! Let me know if you get it up running or not.

  6. #16
    Newbie LXXXIII is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    13

    Re: 'lo, and need some advice

    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.

  7. #17
    Newbie LXXXIII is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    13

    Re: 'lo, and need some advice

    Quote Originally Posted by Xav View Post
    Cool. I play the piano as well.
    What kind of music do you play on it?

  8. #18
    Retired v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light
    Join Date
    Apr 2007
    Posts
    2,942
    Blog Entries
    3

    Re: 'lo, and need some advice

    Uh, changes.

    Quote Originally Posted by LXXXIII
    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++, [...]
    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.)

    I'm still a big fan of imperative programming, especially with C, so I won't comment on your last statement.

    Quote Originally Posted by LXXXIII
    I've decided to pick up functional programming [...]
    You should consider Scheme, Common Lisp or some other LISP-dialect.

  9. #19
    Xav
    Xav is offline
    Code Slinger Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav has much to be proud of Xav's Avatar
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,217
    Blog Entries
    13

    Re: 'lo, and need some advice

    Quote Originally Posted by LXXXIII View Post
    What kind of music do you play on it?
    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.

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

  10. #20
    Newbie LXXXIII is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    13

    Re: 'lo, and need some advice

    Quote Originally Posted by v0id View Post
    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.)
    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.

    I'm still a big fan of imperative programming, especially with C, so I won't comment on your last statement.
    Hehehe! Well, I think C is the lesser of two evils 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.


    You should consider Scheme, Common Lisp or some other LISP-dialect.
    Why is that?

+ Reply to Thread
Page 2 of 4
FirstFirst 1 2 3 4 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)