Hacker News new | ask | show | jobs
by cain 2393 days ago
I was excited to read about this. An upgraded C would be nice. Unfortunately, after the homepage, this seems disastrously opposed to anything resembling a "better" C.

The features page feels extremely painful to read. It took me at least two minutes to even begin to make sense of the first section: "Declarations", then an explanation of Tuple, immediately followed by:

  int i;
  double x, y;
  int f( int, int, int );
  f( 2, x, 3 + i );      // technically ambiguous: argument list or comma expression?
Tuple isn't mentioned again until seven or so lines after its explanation. After reading further, I realise they aren't linked in any way, but this was confusing at first. I thought I was missing something major about the syntax.

  [ y, i ] = [ t.2, t.0 ];    // reorder and drop tuple elements
I don't know what this even means. If this:

  [ i, x, y ] = *pt;      // expand tuple elements to variables
pulls out tuple elements into variables, and this:

  x = t.1;        // extract 2nd tuple element (zero origin)
accesses tuple elements: then what is "reorder and drop" and why does the combination of the above two behaviour result in an ostensibly different third behaviour?

It gets worse the further down the page I try to understand. Very claustrophobic and presented as a mish-mash of syntax examples. I can't see how this is any better than C's syntax, honestly. What C would benefit from is a better baked-in stdlib, OR an easily available, downloadable, lib of helper functionality that doesn't require any modifications to existing code (eg. when I want a hashtable in an already-established project, I don't want to modify my existing structs!)

1 comments

Take a look at D. Some of D's features (such as alias this and mixin templates) may seem strange, but they come from decades of experience with C++ features- Walter Bright and Andrei Alexandrescu, two C++ pioneers, are among D's foremost advocates. WB made the first end-to-end C++ compiler, and AA wrote Modern C++ Design. GCC 9 now supports D.