问题描述
在 XML 模式中,您可以将元素标记为 nillable
,这意味着它可以采用显式 NULL 值.请参阅 nillable 和 minOccurs XSD 元素属性 以获得很好的解释.
In an XML schema you can mark an element as nillable
meaning it can take an explicit NULL value. See nillable and minOccurs XSD element attributes for a great explanation.
我很好奇的是为什么叫nillable
?我总是看到 nillable 并认为这是一个错字!
What I'm curious about is why is it called nillable
? I always see nillable and think it's a typo!
编辑我很欣赏 nil
是 null
的同义词.我想知道为什么选择nil
,而不是更常见的(在计算机科学中)null
.特别是因为它真的应该是 nilable
(注意单个 L)!
EDITI appreciate that nil
is a synonym for null
. What I'm wondering is why nil
was chosen, rather than the more common (in computer science) null
. Particularly as it should really be nilable
(note the single L)!
推荐答案
这取决于您来自计算机科学的哪个部分!
This depends on which part of computer science you're coming from!
如果您查看用函数式语言编写的程序,您会在各处看到 nil
,而且很少看到 null
.碰巧的是,XML 和它的所有兄弟姐妹(例如 XSLT)都与函数式语言密切相关.
If you look at programs written in functional languages, you'll see nil
every where, and very seldom null
. And as it happens, XML and all it's siblings such as XSLT are closely related to functional languages.
这篇关于为什么叫可空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!