shriram / plai-public

Repository for (for now) filing bug reports about PLAI.
6 stars 0 forks source link

explain why we can't (or shouldn't) use wrapping in generic-read #31

Open bremner opened 7 months ago

bremner commented 7 months ago

Contact Details

bremner@unb.ca

Which part are you commenting on?

p. 142, v3.2.2

What's your suggestion?

Up to this point in the book, we have been using a variant type Value to solve exactly this kind of plait typing problem. I think it's natural to consider that approach here, in addition to / instead of flattening to strings. In particular the language can return both 6 and "6" as a result, so it's natural to want to distinguish in the output. Of course this approach has downsides as well, we'd need another result type (since we co-opted the strV and numV names).

BTW, I also noticed the name of the function does not match the call to error. Is that on purpose?