Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Two languages that come to mind which support both the object-oriented paradigm and non-nullable types are (arguably) C++ and (definitely) <a href="http://research.microsoft.com/en-us/projects/specsharp/" rel="nofollow noreferrer">Spec#</a>.</p> <blockquote> <p><em>Spec# is a formal language for API contracts (influenced by JML, AsmL, and Eiffel), which extends C# with constructs for non-null types, preconditions, postconditions, and object invariants.</em> <br/>&mdash; from the Spec# homepage on Microsoft Research</p> </blockquote> <p>The latter is probably not in widespread use (if it's used at all). There you get a non-nullable type by suffixing a type with <code>!</code> (e.g. <code>object!</code> or <code>string![]!</code>).</p> <p>Concerning C++, I'm sure someone clever will find plenty of arguments why C++ should not be mentioned here; being the complex, delicate language that it is, I'm sure that such reasons exist. My argument for mentioning C++ anyway is that apart from pointers (<code>*</code>) (which can very well be <code>0</code>), C++ also has references (<code>&amp;</code>), which have to be initialized to something sensible. The main problem with references is, AFAIK, that they cannot be used for everything. There's probably certain situations, e.g. with memory management or smart pointers, where you cannot get completely rid of pointers.</p> <p>Finally, you could always try to build your own non-nullable wrapper types, e.g. in C#. Probably like many others, <a href="https://stackoverflow.com/users/22656/jon-skeet">Jon Skeet</a> has done so and <a href="http://msmvps.com/blogs/jon_skeet/archive/2008/10/06/non-nullable-reference-types.aspx" rel="nofollow noreferrer">blogged about it</a>. It's a workable solution, but such a <code>NotNull&lt;T&gt;</code> type can feel a bit bulky since it's not truly integrated into the language, as with Spec#.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload