* [Not important] the “not null” notation in Ada 2005
@ 2011-03-25 15:45 Yannick Duchêne (Hibou57)
2011-03-25 15:51 ` Robert A Duff
2011-03-26 7:02 ` Dmitry A. Kazakov
0 siblings, 2 replies; 6+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2011-03-25 15:45 UTC (permalink / raw)
I remember some peoples says here, this is a pity to have “not null”
annotations, while the case which should be clearly marked, is the one
where a reference may be null. I'm OK with that principle. But concretely
what would have been the notation ? “may be null” ? Two reserved words
added for that ? A simple “null” would not have been really expressive
(just a though I get right a few minutes ago).
--
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour
les chiens.
“ c++; /* this makes c bigger but returns the old value */ ” [Anonymous]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Not important] the “not null” notation in Ada 2005
2011-03-25 15:45 [Not important] the “not null” notation in Ada 2005 Yannick Duchêne (Hibou57)
@ 2011-03-25 15:51 ` Robert A Duff
2011-03-25 16:43 ` Yannick Duchêne (Hibou57)
2011-03-26 7:02 ` Dmitry A. Kazakov
1 sibling, 1 reply; 6+ messages in thread
From: Robert A Duff @ 2011-03-25 15:51 UTC (permalink / raw)
"Yannick DuchÔøΩne (Hibou57)" <yannick_duchene@yahoo.fr> writes:
> I remember some peoples says here, this is a pity to have ÔøΩnot nullÔøΩ
> annotations, while the case which should be clearly marked, is the one
> where a reference may be null. I'm OK with that principle. But
> concretely what would have been the notation ? ÔøΩmay be nullÔøΩ ? Two
> reserved words added for that ? A simple ÔøΩnullÔøΩ would not have been
> really expressive (just a though I get right a few minutes ago).
Take a look at OCaml, for example.
- Bob
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Not important] the “not null” notation in Ada 2005
2011-03-25 15:51 ` Robert A Duff
@ 2011-03-25 16:43 ` Yannick Duchêne (Hibou57)
2011-03-25 17:13 ` Robert A Duff
0 siblings, 1 reply; 6+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2011-03-25 16:43 UTC (permalink / raw)
Le Fri, 25 Mar 2011 16:51:24 +0100, Robert A Duff
<bobduff@shell01.theworld.com> a écrit:
>
> Take a look at OCaml, for example.
>
> - Bob
Thanks Bob; but I know SML, not OCaml. Do I really have to learn all of
OCaml to get an idea or can you give some tracks ?
--
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour
les chiens.
“ c++; /* this makes c bigger but returns the old value */ ” [Anonymous]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Not important] the “not null” notation in Ada 2005
2011-03-25 16:43 ` Yannick Duchêne (Hibou57)
@ 2011-03-25 17:13 ` Robert A Duff
2011-03-25 17:29 ` Yannick Duchêne (Hibou57)
0 siblings, 1 reply; 6+ messages in thread
From: Robert A Duff @ 2011-03-25 17:13 UTC (permalink / raw)
"Yannick Duch�ne (Hibou57)" <yannick_duchene@yahoo.fr> writes:
> Thanks Bob; but I know SML, not OCaml. Do I really have to learn all of
> OCaml to get an idea or can you give some tracks ?
The two languages are pretty similar, actually.
If you want a thing, you declare type thing.
If you want a thing-or-null you declare "Thing | Null".
Or maybe something like "List = Pair | Empty_List".
There's a Maybe type -- Maybe(T) means "a T or nothing".
You don't get any sort of null-like value unless you ask for it,
and you don't have to call it "null", and you can have several
such special values.
- Bob
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Not important] the “not null” notation in Ada 2005
2011-03-25 17:13 ` Robert A Duff
@ 2011-03-25 17:29 ` Yannick Duchêne (Hibou57)
0 siblings, 0 replies; 6+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2011-03-25 17:29 UTC (permalink / raw)
Le Fri, 25 Mar 2011 18:13:45 +0100, Robert A Duff
<bobduff@shell01.theworld.com> a écrit:
> The two languages are pretty similar, actually.
> If you want a thing, you declare type thing.
> If you want a thing-or-null you declare "Thing | Null".
Yes, the type constructors. Would have been a good idea, I agree.
--
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour
les chiens.
“ c++; /* this makes c bigger but returns the old value */ ” [Anonymous]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Not important] the “not null” notation in Ada 2005
2011-03-25 15:45 [Not important] the “not null” notation in Ada 2005 Yannick Duchêne (Hibou57)
2011-03-25 15:51 ` Robert A Duff
@ 2011-03-26 7:02 ` Dmitry A. Kazakov
1 sibling, 0 replies; 6+ messages in thread
From: Dmitry A. Kazakov @ 2011-03-26 7:02 UTC (permalink / raw)
On Fri, 25 Mar 2011 16:45:28 +0100, Yannick Duchêne (Hibou57) wrote:
> I remember some peoples says here, this is a pity to have “not null”
> annotations, while the case which should be clearly marked, is the one
> where a reference may be null. I'm OK with that principle. But concretely
> what would have been the notation ? “may be null” ? Two reserved words
> added for that ? A simple “null” would not have been really expressive
> (just a though I get right a few minutes ago).
No notation needed. Before Ada 2005 broke it, "access T" was not null, if
anonymous type is what you mean.
Named type is a different beast. When you declare a named access type "not
null" is a constraint. You cannot have a constrained subtype before the
type.
Yet another story is an access type, which does not have null as a value.
It is not much different from being constrained. Compare it with integer
types. When you declare:
type P is range 1..2;
You do not eliminate 0, as you might think. P has a "parent type," which
still has 0 (P'Base).
So which case you meant? (:-))
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-03-26 7:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-25 15:45 [Not important] the “not null” notation in Ada 2005 Yannick Duchêne (Hibou57)
2011-03-25 15:51 ` Robert A Duff
2011-03-25 16:43 ` Yannick Duchêne (Hibou57)
2011-03-25 17:13 ` Robert A Duff
2011-03-25 17:29 ` Yannick Duchêne (Hibou57)
2011-03-26 7:02 ` Dmitry A. Kazakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox