本文介绍了Clojure #= 阅读器宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从 #= 阅读器宏-expand-before-system-macros">post 在 Stackoverflow 上它解决了一个问题.这个阅读器宏成为一个的可能性有多大语言的官方(记录)部分?如何弃用或改变了行为?

I just "discovered" the #= reader macro from a post on Stackoverflowand it solves a problem. How likely is this reader macro to become anofficial (documented) part of the language? How about deprecated orchanged behavior?

#= 阅读器宏使 Lisp 阅读器对以下 s 表达式求值(在宏展开之前).

The #= reader macro causes the following s-expression to be evaluated by the Lisp reader (before macro expansion).

推荐答案

当某些内容以 *print-dup* true 打印时,核心语言会使用它,所以我打赌它会保留下来.不知道为什么没有记录.

It is used by the core language when something is printed with *print-dup* true, so I'd wager that it is going to stay. No idea why it is not documented.

user=> (binding [*print-dup* true] (prn {:foo 1 :bar 2}))
#=(clojure.lang.PersistentArrayMap/create {:foo 1, :bar 2})
nil

这篇关于Clojure #= 阅读器宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-21 14:26