Computer Science Canada

processes in classes?

Author:  Clayton [ Wed Apr 26, 2006 8:32 pm ]
Post subject:  processes in classes?

is it possible to have a process in a class that you can call (or in a module for that matter) for a music player that i am working on?(im being asked to do it OOT)

Author:  Tony [ Wed Apr 26, 2006 10:40 pm ]
Post subject: 

I think you're looking for Music.PlayFileReturn

Author:  [Gandalf] [ Thu Apr 27, 2006 12:07 am ]
Post subject: 

And to answer your question, yes, it is possible to have a proccess, procedure, function, type, variable, or basically anything else inside a class.

Author:  Clayton [ Thu Apr 27, 2006 12:58 pm ]
Post subject: 

so would you do something like this
Turing:

class Play
export play_from_cd
process play_from_cd
end play_from_cd
end Play

var p:^Play
new Play,p

fork Play(p).play_from_cd

Author:  Tony [ Thu Apr 27, 2006 1:14 pm ]
Post subject: 

no, because that code doesn't work.. have you tried?

I'd do something like
code:

class Play
    export play_from_cd

    process play_process
        for i : 1 .. num_tracks
            Music.PlayFile (filename (i))
        end for
    end play_process

    procedure play_from_cd
        put "lets play"
        fork play_process
    end play_from_cd
end Play

var p : ^Play
new Play, p

p -> play_from_cd


it appears that you can call only procedures and functions, not processes. Though you could create an internal function that would call a process on user's behalf.

Author:  codemage [ Thu Apr 27, 2006 1:24 pm ]
Post subject: 

It's possible to use a process to do that, but it's also possible to feed yourself by placing a chocolate bar between your buttocks and ramming it home with a broomstick.

I don't highly recommend either though.

Author:  md [ Thu Apr 27, 2006 2:25 pm ]
Post subject: 

Using processes in classes is not possible. Using processes is not possible. There is no such thing as processes.

Really, unless you are _complete_ comfortable with the rest of the entire language, and with threading models, and many many other ideas, processes are not something you should even be thinking about.

Author:  Clayton [ Thu Apr 27, 2006 4:09 pm ]
Post subject: 

ok thanks tony that was i kinda obvious thing to do (just didnt try it lol)

Author:  Martin [ Thu Apr 27, 2006 11:57 pm ]
Post subject: 

codemage wrote:
It's possible to use a process to do that, but it's also possible to feed yourself by placing a chocolate bar between your buttocks and ramming it home with a broomstick.

I don't highly recommend either though.


"Windows is easier than Linux, in the same way that crapping your pants is easier than going to the washroom." Wink

Author:  codemage [ Fri Apr 28, 2006 8:45 am ]
Post subject: 

That's a good one. Surprised


: