On 01/09/2011 06:02 AM, Jorge wrote:
Or perhaps to overload * ?
'a' * 5
-> "aaaaa"
?
Probably a bridge too far. Operator overloading this way results in all those
weird implicit conversion behaviors we all know and love (not), true. But at
this point there's the matter of compatibility:
'3' * 5
-> better produce 15
That sort of conversion isn't an entirely unreasonable thing to do, in all
honesty, given that implicit conversion is here to stay at this point.
I'm not opposed to making it easier to get a repeated string. Yet I admit I'm
not so concerned about it that adding to the language itself seems warranted,
when (as demonstrated) it's easy for the developer to do so himself. Aside
from possibly a very small increase in performance if the repetition factor is
large (depending on the implementation), and the functionality being built-in
and thus more convenient, I'm not sure what a repeat method in the
specification buys you over what you can do for yourself.
Jeff
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss