Week 13

Week of October 7, 2018

Fixing an exercise

10-7-2018

The reason things weren’t displaying correctly was I forgot to create paramPassingByValPRO.json. So I created it.

Here is my commit.

Next exercise

10-8-2018

I’m moving on to the by reference proficiency exercise. Right off the bat I’m having trouble with JSAV. In order to reset the exercise, all JSAV elements need to be cleared. Thankfully, most JSAV objects have a clear method. Most. Pointers can’t be cleared this way. The label part of the pointer gets cleared. But the actual pointer part, the arrow, doesn’t get cleared. Without performing any extra steps, resetting the exercise multiple times will result in a mess like this:

JSAV pointers can't be cleared

If I call pointer.hide() before pointer.clear(), then the arrow is also removed from the canvas. I just hope that this approach doesn’t cause extra JSAV objects to get skipped by the garbage collector.

It took some noodling to get this exercise to work. JSAV really puts the burden of setting up an identical starting point for the exercise on the developer. In the by value exercise, this wasn’t too bad since the original arrays were stored in their own variables and could be simply passed along. With pointers, however, I needed to pass along the necessary information to create a new pointer. That is, I needed enough information to know what the pointer in question was pointing to. I ended up just passing a string that said the scope and name of the thing it’s supposed to point to. It’s not pretty.

Here is my commit.