Hacker News new | ask | show | jobs
by lanestp 3583 days ago
Ada has a lot of cool stuff going for it. I liked the type system well enough and a well written Ada program is very easy to read. My problem with it was I always had trouble with the stuff like while ... loop if ... then case ... is The number of times that a program failed to compile because I got the magic words wrong drove me nuts! The author is bang on in the comparison to C which despite its flaws is very internally consistent.
2 comments

There's actually sense to the magic words. Each word which opens a block has a unique word which ends the block. So, begin..end, if..end if, loop..end loop, etc.

The advantage of this is that it's much harder to screw up block terminations --- one thing I've done many times in C is when closing a chain of blocks with:

            }
          }
        }
        do_something();
      }
    }
is to miscount the braces and put do_something() in the wrong place. In Ada, that'd be:

            end if;
          end;
        end case;
        do_something();
      end loop;
    end;
...which is far more meaningful.
That sounds like the cyclomatic complexity is too high.
You should read about how to write clean code... (instead of switching to another programming language)
I agree. I've thought of writing a CoffeeScript-for-Ada thing with slightly nicer syntax. (I don't dislike Ada's syntax, but it's occasionally quirkier than necessary.)

That said, its easy range types and discriminated unions make writing C-level code SO much nicer.