Gail recently had her students create Screenshots of their games for an assessment. Her students were clever, and used the
(text...) function to make their
TITLEs more than Strings. Unfortunately, when it came time to plug these values into the
make_game function, the teachpack returned an error because it was expecting
TITLE to be a String type, not an Image. What's worse, the error message her students got was not particularly helpful. Fortunately, Gail posted here right away, and we were able to diagnose the problem quickly.
However, we immediately made some observations based on Gail's post:
1) The teachpack should really generate better error messages
2) We should allow Gail's students to use images for their titles
I've spent the last week hacking on the teachpack to add both of these, and I'm ready to share a sneak-peek at the work so far. But I thought I'd also take this opportunity to talk about how you can create your very OWN teachpacks in WeScheme. (Warning: our teachpacks use concepts and code that is not explained in Bootstrap, so this is not for the faint of heart!)
Step 1: Make a new file and fill it with definitions and expressions
This is all pretty straightforward.
Step 2: Decide which definitions you want your students to have, and provide them
Using the (provide ..) function, you can select which functions and values students will have access to. Here's a
simple example of a file that declares a single value 'x', and provides it. Notice that it also declares a 'y', but does NOT provide it!
Once you've made your file, click "Share" and then look at the URL that comes back to you (something like "publicId=SOMECHARACTERS"). Copy the part after "publicId=", and make sure you write it down somewhere!
(Tip: don't share the sourcecode when you click share. Usually you want to keep your teachpack hidden, even from someone who has the URL!)
Step 3: Include your teachpack in another file
Open a new file, and use (require...) at the top along with the code from your Teachpack URL. For example:
(require wescheme/ghxFXvXyZ7)
1) Notice that the code after 'wescheme/' matches the URL from the teachpack.
2) Notice that x, which was provided, can be used inside this program
3) Notice y, which was not provided, is totally unknown to this program!
In Summary
Making your own teachpacks can be a great way for advanced teachers to add their own tweaks and projects to the curriculum. You can write tons of behind-the-scenes code, but only expose the parts you want to your students. It's not for the faint of heart, however!
As for Gail's students, I've made a copy of the Bootstrap teachpack which now adds better error messages and support for image-TITLEs. I've also decided to share it with the source visible, for those of you who want to take a look behind the scenes. Be warned -- this code is not meant for public consumption, so it's pretty ugly! I've also removed the EXAMPLEs and test cases for this public posting, so it should never be shown as an example of "good" code for students!
You can also test out the new error messages, by changing any of the image or string definitions to be something else. After a few weeks of testing, we'll release this as an update to the mainline teachpack, so that everyone can benefit from the new features. Gail, thanks to you and your students for posting this question, which has led to some really great improvements for everyone!