Clojure#=阅读器宏 [英] Clojure #= reader macro

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

问题描述

我只是从#= -make-my-macro-expand-before-system-macros> post 在Stackoverflow
,它解决了一个问题。这个读者宏成为一个
官方(记录的)语言的一部分的可能性有多大?

I just "discovered" the #= reader macro from a post on Stackoverflow and it solves a problem. How likely is this reader macro to become an official (documented) part of the language? How about deprecated or changed behavior?

#= 阅读器宏会导致以下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#=阅读器宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆