Author |
Message |
Clayton
|
Posted: 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) |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
|
|
|
|
[Gandalf]
|
Posted: Thu Apr 27, 2006 12:07 am Post subject: (No 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. |
|
|
|
|
|
Clayton
|
Posted: Thu Apr 27, 2006 12:58 pm Post subject: (No 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
|
|
|
|
|
|
|
Tony
|
Posted: Thu Apr 27, 2006 1:14 pm Post subject: (No 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. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
codemage
|
Posted: Thu Apr 27, 2006 1:24 pm Post subject: (No 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. |
|
|
|
|
|
md
|
Posted: Thu Apr 27, 2006 2:25 pm Post subject: (No 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. |
|
|
|
|
|
Clayton
|
Posted: Thu Apr 27, 2006 4:09 pm Post subject: (No subject) |
|
|
ok thanks tony that was i kinda obvious thing to do (just didnt try it lol) |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Martin
|
Posted: Thu Apr 27, 2006 11:57 pm Post subject: (No 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." |
|
|
|
|
|
codemage
|
Posted: Fri Apr 28, 2006 8:45 am Post subject: (No subject) |
|
|
That's a good one. |
|
|
|
|
|
|