IS NOT - NULL or IS - NOT NULL

Sep 15, 2011 at 3:27 PM
Edited Sep 15, 2011 at 3:27 PM

Hi

I'm just implementing a sql-like dialect and am unsure of the best/proper way to implement the above. I have had a check in the sample SQL grammar and IS NULL/IS NOT NULL doesn't appear to be implemented.

I am not sure whether it is best implemented as

  • a Null expression which provides the NULL or NOT NULL options
  • an Is expression which provides the IS or IS NOT options

or perhaps another implementation

I'd be grateful of any thoughts about why one may be better than then other.

Many thx

S

Coordinator
Sep 15, 2011 at 8:19 PM

It can work either way; I assume you are not parsing only, but executing it as well? Then it depends on execution semantics, which way is more logical. Do you have "IS" operator outside of this case? See then if you could put NULL-comparison semantics into this. For parsing, these differences should not matter much, it will result only in different naming of non-terminals but essentially the grammar structure will be the same. 

Sep 16, 2011 at 4:54 AM
I would like to say something on this matter...

May be I don't undesrtand you correctly, I think you are asking for the check situation (not setting the nullable attribute of a column).

Think about this: having "IS NOT" will allow you to apply it for things that aren't NULL [as in "something IS NOT anotherthing"], also what will mean "NOT NULL" in a different context? Here you have an oportunity to differentiate your language giving meaning and good use to "NOT NULL"... I can't think of an example, and that's the point, make a language that makes me think different... or else, why don't you use an existing one?* Otherwise just drop the "like" of "sql-like", it is an sql dialect, stand by that and be proud of it.

So for the check "IS NOT" will be the way to go, unless you have a good use for "NOT NULL" in other places and you have no trouble making a negation of the comparison to other things (you only use IS for NULL, or you are ok to make NULL the special boy that doesn't require "NOT (something IS NULL)" or similar).

I don't know the language you are making or how it will be used, so don't take this as the last word, just consider it. If you are making this languages because you need it, and you don't need it good, but you need it yesterday... then whatever you find more confortable implementing will do.

*: Look what other languages do, see if you can find the specs of the standard of the languages you are basing upon, did you mention SQL? Well did a quick search and found something that you may want to give a read to: http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt [Of course, if you need this yesterday, you may want to skip the lecture]

Have my appologise for disturbing.

2011/9/15 woopsie <notifications@codeplex.com>

From: woopsie

Hi

I'm just implementing a sql-like dialect and am unsure of the best/proper way to implement the above. I have had a check in the sample SQL grammar and IS NULL/IS NOT NULL doesn't appear to be implemmented.

I am not sure whether it is best implemented as

  • a Null expression which provides the NULL or NOT NULL options
  • an Is expression which provides the IS or IS NOT options

or perhaps another implementation

I'd be grateful of any thoughts about why one may be better than then other.

Many thx

S

Read the full discussion online.

To add a post to this discussion, reply to this email (irony@discussions.codeplex.com)

To start a new discussion for this project, email irony@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Sep 16, 2011 at 10:18 AM

Thx for both replies.  In the end I opted for the IS NOT option.