Not a bug
BYOND Version:512.1444
Operating System:Windows 7 Home Premium 64-bit
Web Browser:Chrome 70.0.3538.77
Applies to:Dream Maker
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:
You can create a typepath (even completely describe an object) within a local proc.

I believe this to be a bug because I think typepaths should be declared outside of procs.

Numbered Steps to Reproduce Problem:
See code snippet.

Code Snippet (if applicable) to Reproduce Problem:
/obj/A/var/a = 5
world.log << ispath(/obj/A)
var/obj/A/E = new
world.log << E.a

Expected Results:
Compilation error, /obj/A is not a typepath, especially since x() was never called to begin with.

Actual Results:
Welcome BYOND! (5.0 Beta Version 512.1444)

Does the problem occur:
Every time? Or how often? Every time.
In other games? N/a
In other user accounts? N/a
On other computers? N/a

When does the problem NOT occur? N/A

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit to download old versions for testing.)

I tested it on 512.1444 and 512.1454.


Don't do that, I guess. It can be a problem in a very large project since the typepath is valid within the full scope of the project and this can have unintended consequences.
This isn't a bug, by using / in front of the path you're essentially placing it at the top-level of the code. The code tree works a lot like a file tree, it even includes things like "." and ".." in a similar context and you can use "." and ":" to actually traverse the tree at compile-time a single step at a time; "/" does a similar thing except it skips to the top of the tree.
This is counter-intuitive, and I don't believe it is useful. I would expect things within a proc to be local variables. Better yet, not describe objects within a proc.

Also, while this works for variables, it (fortunatly) does not work for procs.


world.log << ispath(/obj/A)
var/obj/A/E = new
world.log << E.y()

Results in
loading test.dme /obj/A: undefined type path E.y: undefined type: E.y /obj/A/proc/y: undefined type path E: unknown variable type
test.dmb - 4 errors, 0 warnings (11/1/18 6:24 pm)
Lummox JR resolved issue (Not a bug)
Counterintuitive it may be, but it's an actual feature of the language that's been in place forever. Probably not a lot of people will find it terribly useful, but there you go.

If anything, the fact that you can't use this to define a proc might be a bug.

Login to reply.