Open abeisgoat opened 9 years ago
If you use null is the context where a type is expected, this warning will be printed:
bolt:1:11: Type names should begin with an uppercase letter: ('null' should be 'Null').
bolt: No type definition for: null
I'd prefer being explicit about language syntax rather than allowing typos to slip through (confusing for readers who know the difference between null and Null).
I think the distinction between Null
and null
in Bolt is unnecessary. Consider this:
type PostBody {
validate() {
this.body !== null || this.image !== null
}
body: String | Null,
image: String | Null
}
Using Null
in the validate rule expects there to be a variable called Null. If that existed you'd have three different nulls and a very difficult validate rule to reason about.
Interestingly, when I had Null
in the validate rule, the compiler didn't catch the error. It was only when I tried deploying the rule that it failed. Because of that, there was no helpful line number reference to aid with debugging.
I understand from a logical standpoint that
Null
is a type and thus should have a have a capital "N" vs true/false which are built in values of Boolean type, however I think we need to consider the users who will be writing Bolt scripts.I don't think many people will recognize Null as a type and they will think of it as an empty value and will probably forget the capital N causing unneeded confusion.
Thoughts?