The newly added scope operator has a use case to get initial values for variables. According to the reference page:
If A::B isn't a static var, then it's equivalent to initial(A:B). If A is a constant type path, the compiler will go even further by compiling this expression as the actual initial value instead of doing a runtime lookup.
However, upon testing I wasn't able to achieve the runtime lookup at all, the operator always returned the compiled time value depending on the variable's compile time type (and in case the variable had no type defined it wouldn't compile at all).
Numbered Steps to Reproduce Problem:
1. Define a variable with a set type (ex. var/atom/testVar)
2. Assign a value to the variable (ex. testVar = new /mob())
3. Use the :: operator (usr << testVar::name)
4. Compare the results with what initial() would return (usr << initial(testVar:name))
Code Snippet (if applicable) to Reproduce Problem:
mob/verb/Test()
var/atom/myTestVar = /mob
usr << initial(myTestVar:name) // outputs mob
usr << initial(myTestVar.name) // outputs mob
usr << myTestVar::name // outputs atom
var/atom/myTestVar2 = new /mob()
usr << initial(myTestVar2:name) // outputs mob
usr << initial(myTestVar2.name) // outputs mob
usr << myTestVar2::name // outputs atom
Expected Results:
The :: operator returns the same result as the initial proc when used in a similar fashion.
Actual Results:
The :: operator only seems to return compile time values.
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?
-
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Tested in 515.1606 and 515.1608 (also tried in 515.1597 and 515.1598 but those were completely broken)
Workarounds:
Use the old initial() method to get runtime initial values instead of the scope operator.</<></<>