Author |
Message |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
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) |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
|
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
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. |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
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
|
|
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
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. |
|
|
|
![](images/spacer.gif) |
codemage
![](http://usera.imagecave.com/codemage/codemage-small.gif)
|
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. |
|
|
|
|
![](images/spacer.gif) |
md
![](http://compsci.ca/v3/uploads/user_avatars/1849317514ed6c4399768d.png)
|
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. |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
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) |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Martin
![](http://www.compsci.ca/wiki/images/4/46/CanadianStickUp.jpg)
|
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." ![Wink Wink](http://compsci.ca/v3/images/smiles/icon_wink.gif) |
|
|
|
|
![](images/spacer.gif) |
codemage
![](http://usera.imagecave.com/codemage/codemage-small.gif)
|
Posted: Fri Apr 28, 2006 8:45 am Post subject: (No subject) |
|
|
That's a good one. ![Surprised Surprised](http://compsci.ca/v3/images/smiles/icon_surprised.gif) |
|
|
|
|
![](images/spacer.gif) |
|