News for hackers. Stuff that matters.
Re:Tor in a safer language: Network team update from Amsterdam by nickpsecurity on Saturday April 01, 2017 @04:16PM (#14013936)
I'll give you it's overly verbose even though quite a bit of it was justifiable. The theory of Ada's designers was that people read software more than write it. So, the syntax should be designed to facilitate catching errors in maintenance mode, during extensions, or during integrations. It's done phenomenal at that per industrial, case studies despite having been invented in the 80's when lots of language decisions were still being debated.

EDIT: I keep thinking a different language that acts as a front end w/ a better syntax might be a good idea. It outputs Ada that integrates with the tooling ecosystem. Also, a seemless FFI for C libraries like Julia's.

Re:Tor in a safer language: Network team update from Amsterdam by socmag on Saturday April 01, 2017 @06:11PM (#14014463)
I totally agree that code should be written to be read.

It certainly wouldn't hurt if people simply used a more literate programming style no matter what language they choose

Far too many people think code as below is acceptable.

This is C obviously, but pretty much equal horrors around in every language.

This isn't 1994 and the compiler really doesn't care how long your variable names are, plus EatWhite() is pretty damn fast.

  const int to_pn  = base_n ^ label_n;
      const int from_p = _array[to_pn].check;
      const int base_p = _array[from_p].base ();
      const bool flag
        = _consult (base_n, base_p, _ninfo[from_n].child, _ninfo[from_p].child);
      uchar child[256];
      uchar* const first = &child[0];
      uchar* const last  = flag ? _set_child (first, base_n, _ninfo[from_n].child, label_n)
        : _set_child (first, base_p, _ninfo
Re:Tor in a safer language: Network team update from Amsterdam by wott on Saturday April 01, 2017 @09:22PM (#14015175)
> This is C obviously

No, that's C++.

Re:Tor in a safer language: Network team update from Amsterdam by __david__ on Saturday April 01, 2017 @11:02PM (#14015527)
You can't say that definitively based on that code. It could very well be C code. There's nothing there syntactically that a straight C compiler would barf on.
Re:Tor in a safer language: Network team update from Amsterdam by socmag on Monday April 03, 2017 @05:29AM (#14021569)
Absolutely correct.
Re:Tor in a safer language: Network team update from Amsterdam by smitherfield on Sunday April 02, 2017 @02:35AM (#14016149)
It could be C if `_array` is an array of

  struct {
          int check;
          int (*base)(void);
  };
Re:Tor in a safer language: Network team update from Amsterdam by socmag on Monday April 03, 2017 @05:27AM (#14021559)
It is!
Re:Tor in a safer language: Network team update from Amsterdam by socmag on Monday April 03, 2017 @05:28AM (#14021566)
It is C.
Re:Tor in a safer language: Network team update from Amsterdam by bluejekyll on Saturday April 01, 2017 @05:15PM (#14014230)
> I keep thinking a different language that acts as a front end w/ a better syntax might be a good idea... Also, a seemless FFI for C libraries like Julia's.

You mean Rust I think ;)

Re:Tor in a safer language: Network team update from Amsterdam by nickpsecurity on Saturday April 01, 2017 @07:01PM (#14014653)
People have had a hard time learning Rust. I also get gripes about its inconsistency in language syntax. The FFI I hear is good. It certainly doesn't output to SPARK or a C subset designed for easy, static analysis.

So, Rust ain't the Ada makeover Im thinking about. It's also in a stability-oriented freeze of existing design right now. So, the makeover will need to be a different language.

Re:Tor in a safer language: Network team update from Amsterdam by bluejekyll on Sunday April 02, 2017 @01:00AM (#14015870)
> People have had a hard time learning Rust.

I won't lie to you. It took me longer to produce good code in Rust than almost any other language I've recently learned. But it's worth it; it's quite simply amazing that it is capable of guaranteeing what it does, with nearly zero overhead. Also, I'd say in many ways it's simpler than C, because it has no undefined behavior; I don't need to concern myself with any of the nuances that I had to learn in C. I highly encourage you to give it two weeks, that's what it took me to become hooked.

Re:Tor in a safer language: Network team update from Amsterdam by eternalban on Saturday April 01, 2017 @08:38PM (#14015024)
That type system is pretty sophisticated. You could probably slap a FP front-end ala Haskell but that would hardly make it more accessible. Might as well just bite the bullet and learn the language.