211 karma · joined July 2, 2023
[0]: https://en.wikipedia.org/wiki/Halstead_complexity_measures
case 'a' .. 'z', 'A' .. 'Z', '0' .. '9', '_': ...;
although when working with enumerators, there is a still a risk caused by the fact that re-ordering enumerators or adding new ones can break the switches.Despite of the drawback I prefer. Also a Range can be a formal expression which simplifies the grammar of other sub-expressions and statements, not only switches but also array slices, tuple slices, foreach, literal bitsets, etc.
this is what the D programming language does. Every var declaration has a well know value, unless it is initialized with void. This is nice, optimizing compilers are able to drop useless assignments anyway.
On top of that another problem with compression is that it is not neutral, bad compressors, especially in the digital domain can introduce aliasing.
Also search for the "loudness war". This is how we called the problem back in the mid 2000's.
enum arr = { return iota(5).map!(i => i * 10).array; }();
static assert(arr == [0,10,20,30,40]);The FreePascal compiler would warn about the missing init (first example of the "The Heap and Use After Free" section).
That being said I think that uninitialized locals is really something from an other age. Modern languages should always default-initialize locals. Speed of execution is not an issue as optimizing-compilers are able to remove dead assignments.
> Strasbourg is German
?. Humor ?
- https://github.com/nonprofits is a 404
- https://github.com/github/forgoodfirstissue should be replaced with https://forgoodfirstissue.github.com/
As usual that will be fixed within the 10 to 600 mins.
D has something similar too (aka IFTI), but otherwise that is more like the C++ inference system. So you can actually infer many things by a call to a function. Examples
array base type:
void v1(T)(T[] t);
int[] arg1;
v1(arg1); // during monomorphization `T` is `int`
template (unspecialized) + its generic args: void v2(T,U)(T!(U) tu);
struct S(T);
S!int arg2;
v2(arg2); // during monomorphization `T` is `S` and `U` is `int`.How does this have to do with expressiveness ?