'var' documentation addition


#1

I've had to dig into the code a couple of times recently to check what happens if

var operator[] (const Identifier& propertyName)

doesn't find the property. 

Turns out it returns var::null, but it would be nice to have this in the docs for quick reference! 

 

It would also be nice to have a var::isNull() method to go along with isVoid() etc.. 


#2

Well, the only reason that static member is called var::null and not var::void is because void is a keyword. Void is a better name for that concept.

And a top tip is to avoid using var::null and prefer to just use var() if you need a void one. Same with String::empty, ValueTree::invalid, etc. It's much better for the compiler if you don't create an unnecessary reference to a static member variable that it has to assume could be volatile.


#3

The context im using it in is checking that a property exists after parsing some json. Are you saying its better to check against an empty var() or that i could in fact use isVoid()? 


#4

You can call isVoid, which is basically a faster way of saying "== var()"