是否可以区分类型化和非类型化的嵌套引用?
例如,给定 <@ let x = <@ 1 @>;在 x @>
和 <@ let x = <@@ 1 @@>;在 x @>
中,我可以将两者与 Patterns.Let(_, (Patterns.Quote(_) as q), _) -> 相匹配q
但我无法区分类型化和非类型化 q
。
For example, given <@ let x = <@ 1 @> in x @>
and <@ let x = <@@ 1 @@> in x @>
, I can match both with Patterns.Let(_, (Patterns.Quote(_) as q), _) -> q
but I can't differentiate between the typed and untyped q
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有趣的。似乎引文总是以键入的形式存储。
引号内的
<@@ 1 @@>
子表达式的类型始终为Expr
。但是,变量x
的类型在您的两个引用中有所不同:但我不确定如何使用它来区分一般情况下的两种情况。似乎只有查看上下文才能做到这一点(而且可能的上下文太多了......)
Interesting. It seems that quotations are always stored in the typed form.
The type of the
<@@ 1 @@>
sub-expression inside the quotation is alwaysExpr<int>
. However, the type of the variablex
differs in your two quotations:But I'm not sure how to use this to differentiate between the two cases in general. It seems that you can only do that if you look at the context (and there are just too many possible context...)