gpt4 book ai didi

clojure - 为什么 Clojure 缺少用户定义的读取器宏?

转载 作者:行者123 更新时间:2023-12-02 11:30:30 28 4
gpt4 key购买 nike

据我了解,Clojure 不会公开读取器宏表或允许用户定义读取器宏。

来自http://clojure.org/reader :

The read table is currently not accessible to user programs.

我只是想知道是否有明确或明确的声明(可能来自 Rich Hickey)说明将它们排除在 Clojure 之外的理由。

注意,我不是问Clojure 缺少用户定义的读取器宏是好是坏。只是想知道为什么。

最佳答案

来自link在 Matt 的评论中,引用 Clojure 的作者 Rich Hickey 的回答:

I am unconvinced that reader macros are needed in Clojure at this time. They greatly reduce the readability of code that uses them (by people who otherwise know Clojure), encourage incompatible custom mini- languages and dialects (vs namespace-partitioned macros), and complicate loading and evaluation.

To the extent I'm willing to accommodate common needs different from my own (e.g. regexes), I think many things that would otherwise have forced people to reader macros may end up in Clojure, where everyone can benefit from a common approach.

Clojure is arguably a very simple language, and in that simplicity lies a different kind of power.

I'm going to pass on pursuing this for now,

Rich

关于clojure - 为什么 Clojure 缺少用户定义的读取器宏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32453062/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com