Archive for November, 2005

A New Style of If Statement

November 21, 2005

After having to hashout the meaning of crapilly (is that a word?) written logic, I have a rather ingenious syntax proposition. Currently, most development languages (C#, Java, C++, etc.) handle compound logic conditions that define the outcome of if (and other logic flow) statements in a rather cumbersome fashion. For example, if I wanted to describe the logic condition for logic based on an integer x as “if x is equal to 7, or x is equal to 9, or x is equal to 10,” I would normally write it as:

if(x==7 || x==9 || x==10) {
//Do something…
}

Although this works (obviously, since the development community has used it over 7.3 billion times), it would be substantially more convenient to describe the condition of the statement as follows:

if(x==(7 || 9 || 10)) {
//Do something…
}

This would be logically equivalent to the first if statement, but would provide a cleaner mechanism for declaring the defining logic. There does not seem to be any loss of detail, and is equivalent to morphing the sentence “if x is equal to 7, or x is equal to 9, or x is equal to 10″ to “if x is equal to 7, or 9, or 10.”

I know, I know, it’s picky. But writing/modifying a grammar for it is quite easy (for fun: anyone want to verify that the supporting grammar for the new if statement can be written as context-free?) and every saved keystroke lengthens the amount of time to the inevitable: carpal tunnel! The only foreseeable problem is that its difficult to accommadate for it in an expression tree if it wasn’t accounted for in precompile parsing, but this is a surmountble issue. Someone please introduce this in any new, upcoming Java/C# specs…

I can’t believe it…

November 18, 2005

…I have a blog. I used to despise blogs, but that has recently changed. I tend to find blogs either too opinionated, poorly written, bloated, and just basically useless. But then I had an epiphany: if I were to create my own blog, then some subset of the entire set of blogs would be useful, which would imply that not all blogs are useless. If you want to know about software, the industry, and how things *should* be, stay tuned;-)