- Can crash the game: ❓ unknown
- Bypasses typechecking: ✅ no
- Program A defines a public function
- Program B uses the function
- Program B is in the middle of running the function or in the middle of executing CBotInstrCall before calling the function
- The game is saved
- A new version of the game introduces a built-in with the same name
- The game is loaded
- Program A fails to compile bedcause it tries to overload an external function
- Program B compiles succesfully if the signature of the new external function happens to allow this
- Program B continues running.
- Can crash the game: ❌ yes because this allows arbitrary user-supplied code to be replaced with different user-supplied code in a runnig program
- Bypasses typechecking: ✅ no
- Program A defines a public function
foo()
- Program B defines a function
bar()
with two overloads - Program B calls
bar(..., foo(...), ...)
- The interpreter picks the first overload
- Program B is in the middle of running
bar()
- The game is saved
- A new version of the game introduces a built-in named
foo()
- The game is loaded
- Program A fails to compile - same as above
- Program B happens to compile successfully, but the game picks the second overload of
bar()
- Program B continues running
A built-in constant, external function, field of a built-in class or method of a built-in class changes return type - causes a different overload to be selected
- Can crash the game: ❌ yes because this allows arbitrary user-supplied code to be replaced with different user-supplied code in a runnig program
- Bypasses typechecking: ✅ no
Similar to above
- Can crash the game: ❌ yes
- Bypasses typechecking: ✅ no
- Program A defines a public function
fooA()
- Program B defines a public function
foo()
with a different return type thanfooA()
fooA()
is renamed tofoo()
and the editor is closed by pressing "Cancel". Program A now has a compilation error becausefoo()
is already defined- Program C defines a function
bar()
with two overloads - Program C calls
bar(..., foo(...), ...)
- The interpreter picks the first overload
- Program C is in the middle of running
bar()
- The game is saved
- The game is loaded
- Now program A compiles fine and program B has a compilation error because
foo()
is already defined - Program C picks a different overoad of
bar()
because the return type offoo()
is now different
- Can crash the game: ❓ unknown
- Bypasses typechecking: ❌ yes - may cause an expression to evaluate to a different type than the one it had at compile time
- Bot A defines a public function
foo()
- Bot B is running a program that uses
foo()
- The player edits
foo()
and changes its return type - The next time bot B calls
foo()
it will return an unexpected type
- Can crash the game: ❌ yes
- Bypasses typechecking: ❓ unknown
- Can crash the game: ❌ yes
- Bypasses typechecking: ✅ no
Where do I even begin? Here are a few fun observations:
- A reference to a class is implicitly convertible to a reference to its base class. We check this when assigning to a variable. This also affects overload resolution. Seems quite sensible, except the inheritance hierarchy can change at any time
Foo extends Bar
can becomeFoo extends Moo
or evenBar extends Foo
. - Most issues related to public function signature or body changing hat I have described above probably apply to methods too plus classes have inheritance plus methods can be overridden, which probably adds more tricky edge cases, especially since the inheritance hierarchy is changeable.
- One file can add a method to a class defined in a different file
void Foo::Bar() { message("a new method"); }
. How? Why? At least the new method is only visible from the file that adds it and does not appear to affect other files.
0 or more required parameters + 0 or more overridden defaults + 0 or more defaults
-
Public function
- Parameter added
- Parameter removed
- Default parameter type changes
- Parameter default removed
- Parameter default added
- Overload added
- Overload removed
-
Public class
- Class of instance removed
- Class of instance added
- TODO: Base class of instance removed
- TODO: Base class of instance added
- TODO: Base class of instance is replaced with a different class
- TODO: Public field of instance removed
- TODO: Public field of instance added
- TODO: class hierarchy changes - changes overload resolution
- TODO
Functions can be:
- Local
- Public
- External
When compiling
External call shadows all user-defined functions with the same name - overloads are not checkedIrrelevant: we can not define an overload for a built-in- Public and local functions participate in overload resolution on equal terms