I tried doing some of the problems, and ended up having a sort of hard time. For example, one of the in-class exercises is to make a function “ntimes” which takes a function as an argument and chains n invocations of the function together, and returns a new function. The solution in class uses an extern function, which basically means, “don’t bother trying to figure out the lifetime”. That seems unsatisfactory to me, so I tried for a long time to explicitly parameterize the lifetime, and explain that the function that is returned should share the lifetime of the function passed in. However, this seemed hard or impossible. I feel like pedagogically, you should only show students things that are safe done “the right way” for as long as possible, and not jump right into the, “ok, this is dirty, but we have to do this to get things done.”
This was just in the first class or two though, so I don’t have very much insight into how well it went for teaching an OS course.
I tried doing some of the problems, and ended up having a sort of hard time. For example, one of the in-class exercises is to make a function “ntimes” which takes a function as an argument and chains n invocations of the function together, and returns a new function. The solution in class uses an extern function, which basically means, “don’t bother trying to figure out the lifetime”. That seems unsatisfactory to me, so I tried for a long time to explicitly parameterize the lifetime, and explain that the function that is returned should share the lifetime of the function passed in. However, this seemed hard or impossible. I feel like pedagogically, you should only show students things that are safe done “the right way” for as long as possible, and not jump right into the, “ok, this is dirty, but we have to do this to get things done.”
This was just in the first class or two though, so I don’t have very much insight into how well it went for teaching an OS course.