在计算机术语中,"non-directory" 叫什么?
In computer terminology, what is a "non-directory" called?
这个问题听起来可能很天真,但我知道在分层文件系统中,目录可以包含其他文件。但是,我无法为不是目录的东西(即普通 "files")想出一个好名字 - 自 class Directory extends Files
以来我不能只称它们为文件。
我想做类型安全的操作(例如,如果我尝试列出文件或读取目录,编译将失败):
sealed trait File {
def path: Path
}
case class Directory(path: Path, children: Iterable[File]) extends File
case class VanillaFile?(path: Path, contents: Iterable[Byte]) extends File
VanillaFile
应该取什么更好的名字?
编辑:
正如所指出的,在某些文件系统中还有一件事:
case class SymbolicLink(target: File) extends File
我很想将 Trait
命名为其他名称,例如 FileSystemNode
或 FileSystemEntry
,然后只需使用 File
、Directory
、SymLink
等。当然,在这个问题上问语言学家比问工程师更好:https://english.stackexchange.com/questions/150806/what-is-the-noun-for-either-a-file-or-folder
根据Andy Turner的建议,"regular file"是一个标准术语:
这个问题听起来可能很天真,但我知道在分层文件系统中,目录可以包含其他文件。但是,我无法为不是目录的东西(即普通 "files")想出一个好名字 - 自 class Directory extends Files
以来我不能只称它们为文件。
我想做类型安全的操作(例如,如果我尝试列出文件或读取目录,编译将失败):
sealed trait File {
def path: Path
}
case class Directory(path: Path, children: Iterable[File]) extends File
case class VanillaFile?(path: Path, contents: Iterable[Byte]) extends File
VanillaFile
应该取什么更好的名字?
编辑: 正如所指出的,在某些文件系统中还有一件事:
case class SymbolicLink(target: File) extends File
我很想将 Trait
命名为其他名称,例如 FileSystemNode
或 FileSystemEntry
,然后只需使用 File
、Directory
、SymLink
等。当然,在这个问题上问语言学家比问工程师更好:https://english.stackexchange.com/questions/150806/what-is-the-noun-for-either-a-file-or-folder
根据Andy Turner的建议,"regular file"是一个标准术语: