ID:2274403
 
BYOND Version:511
Operating System:Windows 10 Pro 64-bit
Web Browser:Firefox 54.0
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:

Calling initial() on type, parent_type, and potentially other constant built-in vars yield compiler errors

Code Snippet (if applicable) to Reproduce Problem:
/world/New()
var/datum/y = /datum/a
log << "[initial(y.type)]"
log << "[initial(y.parent_type)]"
var/datum/a/x = new
log << "[initial(x.type)]"
log << "[initial(x.parent_type)]"
del(src)

/datum/a
var/whatever = 4


Expected Results:

/datum/a
/datum
/datum/a
/datum

Actual Results:

loading asdf.dme
asdf.dm:5:error: y.type: cannot change constant value
asdf.dm:6:error: y.parent_type: cannot change constant value
asdf.dm:8:error: x.type: cannot change constant value
asdf.dm:9:error: x.parent_type: cannot change constant value
asdf.dmb - 4 errors, 0 warnings (7/27/17 10:40 am)

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? Never

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Unknown

Workarounds:
/proc/type2parent(child)
var/string_type = "[child]"
var/last_slash = findlasttext(string_type, "/")
if(last_slash == 1)
switch(child)
if(/datum)
return null
if(/obj || /mob)
return /atom/movable
if(/area || /turf)
return /atom
else
return /datum
return text2path(copytext(string_type, 1, last_slash))


I'm pretty sure there's an existing report already covering this. It's a known problem. I looked into it at one point and it does seem fixable, although difficult.