ID:2172860
 
BYOND Version:510
Operating System:Windows 7 Ultimate 64-bit
Web Browser:Chrome 54.0.2840.87
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
Running a for loop on datums does not return atoms as well. As atoms are a child of datums, they should be included as well.

Numbered Steps to Reproduce Problem:
1. do a for loop for every datum in world, outputting somewhere
2. Observe that only datum specifically are returned, instead of everything.

Code Snippet (if applicable) to Reproduce Problem:
/datum/thingone
name = "the datum"

/obj/thingtwo
name = "the object"

var/holder = new /datum/thingone
var/object = new /obj/thingtwo

/proc/findthings()
for(var/datum/thing)
world.log << "[thing]"


Expected Results:
All types but client are returned as datum is the parent

Actual Results:
Only specifically datums are returned

Does the problem occur:
Every time? Or how often?
Every time
In other games?
Yes
In other user accounts?
Yes
On other computers?
Yes

When does the problem NOT occur?
It always occurs

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
The code utilizing it was implemented in 508, so that's the last version I definitely know of it working.

Workarounds:
Create a seperate loop for atoms


As doing this operation is performance heavy, we haven't utilized the code for it in months. The code is used for debugging the garbage collection system, and is usually behind a disabled define.
The relevant code that I noticed this at is here
https://github.com/tgstation/tgstation/blob/master/code/ controllers/subsystem/garbage.dm#L254


Are you saying this stopped working the same after 508? No real change went into the loop handling process that would account for such a thing. I would expect this to have been around forever.
August 31st last year, the code was working as expected. I used it to find and fix GC issues, and it did include atoms in the list.
Last I heard this was intended. And there was some bypass trick
yep.

So how it works is

for (var/datum/D in world)


Returns everything, but

for (var/datum/D)


only returns path children, not type children (ie, only types that start with /datum/)

And honestly, I rather like it this way. It makes doing certain things in VV a bit easier to code for my rewrite.