Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some problems with Nullable #51

Open
jacob-carlborg opened this issue Feb 10, 2016 · 0 comments
Open

Some problems with Nullable #51

jacob-carlborg opened this issue Feb 10, 2016 · 0 comments

Comments

@jacob-carlborg
Copy link
Collaborator

There are some problems with the Nullable implementation in ddb:

  1. The way Variant is used, with a void* it doesn't compile. It think it's because null has its own type now. This is easily fixable, replace void* with typeof(null)
  2. Nullable doesn't allow to store types that are already nullable. This might cause a problem for strings. Since in D there's no practical difference compared to null and an empty string. One the other hand databases usually do make a difference between the empty string and NULL. I guess it's possible to check .ptr if a string is null or not, but that will result in a different API for checking if something is null or not
  3. It's a bit wasteful to use a pointer (8 bytes on 64bit) to indicate if a value is present or not. A Nullable!(bool) has the size of 16 while a std.typecons.Nullable!(bool) has the size 2

Thoughts, is this something with could change? We could just go with std.typecons.Nullable, the difference is that it's not possible to assign null to std.typecons.Nullable, it has a nullify method instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant