如何从clojurescript程序中获取我所在的Clojurescript命名空间? [英] How can I get the Clojurescript namespace I am in from within a clojurescript program?

查看:54
本文介绍了如何从clojurescript程序中获取我所在的Clojurescript命名空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从clojurescript程序中获取我所在的Clojurescript命名空间?我想这样做是为了提供某些调试信息(只需要在开发模式下工作)

How can I get the Clojurescript namespace I am in from within a clojurescript program? I want to do this do provide certain debug information (it only needs to work in dev mode)

推荐答案

命名空间不是一流的在ClojureScript中就像在Clojure中一样。绝对无法在运行时获取名称空间。如果您不害怕访问某些ClojureScript编译器内部组件,则可以在宏扩展时获取此信息。可能应该有一个API,但是我们还没有。

Namespaces are not first class in ClojureScript as they are in Clojure. There's absolutely no way to get the namespace at runtime. It is possible to get this information at macroexpansion time if you're not afraid of accessing some the ClojureScript compiler internals. There should probably be an API for this - but we're not there yet.

这篇关于如何从clojurescript程序中获取我所在的Clojurescript命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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