Hard, sound/unsound

2017-10-31  本文已影响0人  98Future

刚看了一下斯坦福编译原理考卷,最难的题目考点基本上就是在sound/unsound 以及dynamic type, subtype之间

答案还蛮好理解的,但是想出这段代码还挺难的

这里之所以unsound因为

y declare 为A type,但是在runtime的时候,实际上是一个constant A type. 然后y.mutate()的话实际上就是在mutate constantA. 因为constant是不能被mutate的,所以unsound

上一篇 下一篇

猜你喜欢

热点阅读