ID:2048056
 
(See the best response by Super Saiyan X.)
After slaving over my homework and my project all semester long, it's looking like I'll finally have some free time to get back into DM for a little while. To make things a little less vague with the more advanced concepts in DM, I'm looking to find the overlap between the conventional programming language and DM. Here are my two questions:

1. Is a datum treated like a class in Java?

2. Can the spawn() function basically be classified as multithreading?
Best response
Azurift wrote:
After slaving over my homework and my project all semester long, it's looking like I'll finally have some free time to get back into DM for a little while. To make things a little less vague with the more advanced concepts in DM, I'm looking to find the overlap between the conventional programming language and DM. Here are my two questions:

1. Is a datum treated like a class in Java?

Yeah, of course. Every object definition (each "type") is a class.

In Java terms;
datum is like the Object class.
atom extends datum.
movable extends atom.

mob extends movable.
obj extends movable.

turf extends atom.
area extends atom.

In a sense; movable, atom, datum should be considered abstract classes or interfaces; and mob, obj, turf and area implement them. You're really not /supposed/ to use them as standalone things.

2. Can the spawn() function basically be classified as multithreading?

It's a form of psuedo-multithreading. It's not actual multithreading.
This explanation certainly clears the air for me-- thanks!
In response to Super Saiyan X
Super Saiyan X wrote:
It's a form of psuedo-multithreading. It's not actual multithreading.

It's a form of asynchronous programming and it's nothing special.
http://www.byond.com/forum/?post=1638359

DM uses a synchronous scheduler to determine task priority.

spawn and sleep merely pop a task out of sync and then pop it into the scheduler to wait and do it at another time. The difference is that spawn is non-blocking, and sleep is blocking.
In response to Ter13
The funny thing is that sleep() and spawn() are basically identical, mechanically. Both of them duplicate the current proc, but only spawn() will keep going.
In response to Lummox JR
So by that, sleep() is just as bad [as spawn()]?
In response to FKI
FKI wrote:
So by that, sleep() is just as bad [as spawn()]?

I don't know what you mean by "as bad". There's nothing inherently bad about sleep or spawn.
Referring to the overhead incurred by the latter.