[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jun 2 10:04:52 1995 
Subject:Problem with flavours 
From:Jocelyn Paine 
Volume-ID:950603.01 

Can anyone tell me why, in the flavour below, the method for
getline is incorrect? Calling
    make_instance([input_file name 'tt:']) -> f;
    ;;; Opens the terminal on VMS.
    f<-open();
    f<-getline();
    a
gives an arror LIST NEEDED: CULPRIT 97. The 97 is the code for the little
a just typed.

Assigning the result of the recursive call to getline to a variable and
then using that, as in the commented-out code, works OK. Am I missing some
obvious mistake?

    flavour input_file;
        ivars name, repeater;

        defmethod open();
            discin(name) -> repeater;
        enddefmethod;

        defmethod getline();
            lvars c, rest;
            if (repeater()->>c) = `\n` then
                []
            else
    /*OK
                ^getline() -> rest; c :: rest;
    */

                c :: ^getline();    /* NOT OK */

            endif;
        enddefmethod;

    endflavour;


Jocelyn