Re:Better C – A subset of D Programming Language
by lostmsu on Tuesday April 28, 2020 @12:35PM
(#23008704)
A type is much denser, than a textual description, and in most cases sufficient.
[ Parent
| on HN ]
Re:Better C – A subset of D Programming Language
by ben-schaaf on Tuesday April 28, 2020 @01:35PM
(#23009525)
Having each of the generic range functions return a <FN>Result type that all implement some variations of a random access range is absurd. Having "auto map(); Returns an input range" is much denser and helpful than "MapResult map(); struct MapResult { @property bool isEmpty(); ...}".
A more explicit "impl(InputRange) map()" may be better until you consider that map is generic on the kind of range you give it, so that just turns into "impl(MapResult!R) map(R)()". A more roundabout, pointless way of saying "auto".
Re:Better C – A subset of D Programming Language
by gallier2 on Tuesday April 28, 2020 @03:36PM
(#23010898)
> A type is much denser, than a textual description, and in most >cases sufficient.
In feeble languages with simpleton typesystem may be, but in highly generic templated language like D it is not the case. The type is not dense at all.
What's funny is that in general people complain that compiler errors in D are unreadable. You know why they are unreadable?
Because they print out the types of the functions in which the error occurs and that is nothing more than word salad for generic functions.
Types with hundreds of characters are very common.