How about a new keyword "Is" and a new keyword "Nothing". That way, you could code something like this:
Code:
int main() {
void* vp = Nothing;
if (vp Is Nothing) {
cout << "It's nothing, really." << endl;
}
return 0;
}
Also, consider what would happen if we added the keywords "Then" and "End If" to be used instead of the opening and closing curly braces. Also, the parens around the if condition are really unneeded, so lets say they are optional. Now we have:
Code:
int main() {
void* vp = Nothing;
if vp Is Nothing Then
cout << "It's nothing, really." << endl;
End If
return 0;
}
Next we can get rid of semi-colons, as long as we support line-continuation characters. After all, usually you fit an entire statement on a single line anyway, so now this gets rid of a bunch of ugly and unnecessary characters in the code:
Code:
int main() {
void* vp = Nothing
if vp Is Nothing Then
cout << "It's nothing, really." << endl
End If
return 0
}
Next lets say that we want to get rid of curly braces in general, in favor of something a little more descriptive. I propose something like this:
Code:
Function main() As integer {
void* vp = Nothing
if vp Is Nothing Then
cout << "It's nothing, really." << endl
End If
return 0
End Function
Also, if we can get rid of the void*, that would be nice also. Maybe we can come up with some kind of keyword that just means we're declaring a variable, without actually specifying the type (that's basically what void* is anyway). And then declaring the type would be optional. Ok so our new keyword will be...oh I don't know how about "Dim". Could be anything really, but just for illustrative purposes...so lets see what we have now:
Code:
Function main() As integer {
Dim vp = Nothing
if vp Is Nothing Then
cout << "It's nothing, really." << endl
End If
return 0
End Function
Ok, we're almost done. But what should we do with cout? I really don't like those << and >>. I mean, is that some kind of bit-shift operation or what's going on? I think we would be better off if there was some kind of object that had a WriteLine function, just so we were clear on exactly what's happening. Maybe make a Console object...and put that in a System namespace. Ok, so here it is:
Code:
Function main() As integer {
Dim vp = Nothing
if vp Is Nothing Then
System.Console.WriteLine("It's nothing, really.")
End If
return 0
End Function
There, that looks good. Maybe we should ship this off to a c++ comittee to see if they can't do something with it.