Hacker News new | ask | show | jobs
by thesuperbigfrog 1078 days ago
True in 1993.
2 comments

cracks open the "REFERENCE MANUAL FOR THE Ada(r) PROGRAMMING LANGUAGE"

looks like Ada83 specification has address clause though, which can effectively be used as a pointer when combined with System.Address / 'Address attribute. Also has access type, but you can't pass access type around all willy-nilly-like without unchecked_access (added in 95?).

C pointers are more flexible though, that much is true.

edit, almost forgot: the main downside of Ada < 95 is you don't get function pointers, or import/export pragma

I don't remember much of Ada, but here's something very basic I liked (had to look the details up):

You could declare custom integer types like this:

type My_Type is range -5 .. 10;

And then you could reference the range with My_Type'First or My_Type'Last

And there were named parameters.

   for A in Range_Type loop
      I_IO.Put (
         Item  => A,
         Width => 3,
         Base  => 10);
      ...
   end loop;
Nim [1] is like Ada in these ways but less verbose:

    import strutils # Or from strutils import repeat Or etc.
    type Foo = -5 .. 10                # Or range[-5 .. 10]
    echo Foo.low, " ", Foo.high        # range limits
    echo repeat(s = "x", n = Foo.high) # named params
    # var f: Foo = 15   # Will not compile
[1] https://nim-lang.org/