need clarification: will typedef, C struct initialization, etc.

bearophile bearophileHUGS at lycos.com
Thu Jun 3 11:04:52 PDT 2010


Adam Ruppe:
> Do you consider ALL library solutions to be "hacks"? It sure seems
> that way at times.

I have seen some situations where library solutions are not good enough yet:
- std.bitmanip.bitfields is a marvel of programming, but it's trash any way: its code can't be maintained, modified, read. It's past the limit of decency. And its syntax is not as good as C bitfields.
- The best library "typedef" shown so far can't be used two times in the same line, it uses a line of code and file name as workaround, for me this is a hack. I have suggested a gensym() to improve the situation a bit, but even with it the syntax is not that good and it can produce some template bloat.
- The TightArray so far is not good enough for its purposes. Probably it can be improved.
- The suggested replacecement for scope seems to have a bit better semantics (it's an expression and maybe it doesn't suffer some of the implementation bugs of "scope" (see my bug report 4214)), but its syntax is borderline awful, so for now it is not an improvement over the current (buggy) situation.
- All the proposed library implementations of array comprehensions that I have seen are bad (including the one I have used).

Bye,
bearophile


More information about the Digitalmars-d mailing list