On 06/11/2010 20:02, Walter Bright wrote:
Jérôme M. Berger wrote:
I thought D was supposed to be a pragmatic language? All this means
is that we need a compromise between what would be ideal (being able
to represent arbitrary conditions and have them statically enforced
at compile time) and what can be realistically achieved. Your
argument seems to be: "since there are cases which we won't be able
to handle, let's not do anything at all, not even the cases which we
could handle".


The idea is to find a way to solve this in the general case, not the
specific case of non-null pointers. Then we've got dynamite in our
hands, rather than warmed over toast.

Indeed. I agree that the use-case for non-null has some value, and we should try to look for a general solution, instead of adding specific syntax for it. Not only because D seems very close to be able to do this with library code only, but also because solving this in the general way might allow plenty of other interesting type specifications to be defined. For example, with those changes to struct behavior, I wonder how close we could be to directly specify a type such as Java's wildcards (the <? extends Foo> thingy), that would work with arrays or other containers.

--
Bruno Medeiros - Software Engineer

Reply via email to