为什么clojure将名称中的破折号转换为文件系统中的下划线? [英] Why does clojure convert dashes in names to underscores in the filesystem?

查看:123
本文介绍了为什么clojure将名称中的破折号转换为文件系统中的下划线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用clojure几个月了,有一件事我真的不明白为什么命名空间名称中的破折号必须在文件系统中表示为下划线。

I have been using clojure for a couple of months now and one thing I really don't understand is why dashes in namespace names must be represented as underscores in the filesystem. Can anyone explain this to me, and is it possible to be able to use dashes in the filenames too?

推荐答案

这是一个必要的程序,可以在文件名中使用破折号

It's a necessary workaround for Java interoperability.

当Clojure命名空间是AOT(提前)编译到Java .class文件时,它必须有一个名称为有效的Java标识符。破折号在Java类名称中无效,因此Clojure将它们转换为下划线。它还会将 * 的字符转换为 _STAR _

When a Clojure namespace is AOT (ahead-of-time) compiled into a Java .class file, it has to have a name that is a valid Java identifier. Dashes aren't valid in Java class names, so Clojure converts them to underscores. It also converts characters like * into words like _STAR_.

这篇关于为什么clojure将名称中的破折号转换为文件系统中的下划线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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