Lua的文件句柄/标准名称是什么?

huangapple go评论81阅读模式
英文:

What is the canon/standard name for file handle/stream/file stream of Lua?

问题

io.open()返回的东西在Lua 5.4参考手册中称为"文件句柄",而在《Lua编程》第四版中被称为"流"。Lua用户维基中称之为"文件流"(可能不是唯一的名称)。Lua参考手册应该是官方的,但这本书是由语言的创作者编写的,所以两者都应该是权威的,但它们使用了不同的名称。如果有一个官方/标准名称的话,它是什么?有人能提供相关信息吗?提前感谢。

英文:

I noticed that the thing that is returned by io.open() is called differently. I wonder what the canon name is.

  • in Lua 5.4 Reference Manual, it's called a "file handle".
  • in "Programming in Lua" 4/e, it's called a "stream".
  • I saw in Lua Users Wiki that is's called "file stream" (maybe not the only name used in that Wiki)

Lua Reference Manual should be official, but the book is written by a creator of the language, so both should be canon, yet they use different names.

What is the canon/standard name for it, if there is one? Can anyone provides information? Thanks in advance.

答案1

得分: 3

Lua 5.4.6 版权所有 (C) 1994-2023 Lua.org,PUC-Rio

io.stdin
文件 (0x7fff90c0bd90)

这就是为什么参考手册谈到了文件句柄句柄是指向抽象对象的不透明指针。
对于表格也是一样的:

{}
表格: 0x7f86056042d0

但是你不应该担心这些细节。
Lua 编程 中的术语可能是为了迎合具有不同背景的受众而选择的,但我不代表作者。

英文:
Lua 5.4.6  Copyright (C) 1994-2023 Lua.org, PUC-Rio
> io.stdin
file (0x7fff90c0bd90)

That's why the reference manual talks about file handles. A handle is an opaque pointer to an abstract object.
It's the same with tables:

> {}
table: 0x7f86056042d0

But you shouldn't need to worry about these details.
The terminology in Programming in Lua is probably chosen for an audience with diverse backgrounds, but I don't speak for the author.

huangapple
  • 本文由 发表于 2023年6月15日 16:27:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/76480553.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定