ID:1894788
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
This is in the vein of initial(), but would allow you to do a prototype look-up instead.

for instance:

/obj/item/sword::damage


Would tell you what the initial compile-time value for damage for the type /obj/item/sword is.

var/type/t = pick(/obj/item/sword,/obj/item/axe,/obj/item/shield)
var/obj/item/o = new t()
o::damage


Would tell you what the initial compile-time value for damage for the type of the object reference.

If the notation is too confusing (I know it's the namespace path operator in C++), just adding an argument for initial() that would allow you to pass an object or type would be good.
As a workaround, this is always mentioned when this feature is brought up:
var obj/item/o = /obj/item
world << initial(o.damage)
How in the world does that even work?
It's one of those little tricks that snuck into the language early on, I'm not even sure you have to set the variable to anything if you use : instead of .
This should be in the documentation for initial()
In response to Ter13
Ter13 wrote:
This should be in the documentation for initial()

I agree, I had no idea you could check the compile time value of a variable without actually creating a new instance of said type.
I'm gonna post a new thread with a standing invitation for anyone who's so inclined to make improvements to the docs, including adding small inline images. I think there are a lot of users who could add some intelligent text and/or brief examples that would help a lot.
SSX, Kaiochao, DarkCamaigner, Nadrew and Stephen are probably some of the best people for improving the reference. They know more about the quirks of the language than almost everyone else.
I'll just leave this here -- http://ncomproductions.com/bwiki

Make your own documentation :)
Here we are: id:1895493
In response to Nadrew
Nadrew wrote:
I'll just leave this here -- http://ncomproductions.com/bwiki

Make your own documentation :)

Smart. I like.