bearophileHUGS at lycos.com
Mon Jan 17 14:17:41 PST 2011
> Are you saying that (sorry not testing, but since this is fictional at this time anyway):
I have printed similar ASCII tables some times, it was an almost real example.
> isn't good enough?
I am saying that repeat() is worse than a multiplication sign. I am aware you are usually able to replace operators with functions. Operators are functions, written using another syntax.
Even if people around here keep showing me equivalent ways to do things, I find some Python syntax sugar better than D equivalents. List comprehensions, tuple unpacking syntax, tuple destructuring in function signatures, "in" for presence in a linear collection, etc, and sometimes even string multiplications (among those tuple unpacking syntax is probably the most useful and I still hope to see it in future D. I am losing hope to see array/lazy comprehensions in D).
> Maybe there is a performance benefit to not needing join?
In D I write that with no join (untested):
auto s = "+---".repeat(n) ~ "+";
When you want to write an ASCII grid performance is usually not so important. It's more about the amount of cognitive friction, that's here in D is a bit higher.
More information about the Digitalmars-d