Bill Baxter wrote:
Exactly. Especially when I seem to remember several discussions where Walter and Andrei talked about giving D a more mathematics and scientific orientation (might be confusing with someone else though).On Wed, Jul 8, 2009 at 4:12 PM, Andrei Alexandrescu<seewebsiteforem...@erdani.org> wrote:Jérôme M. Berger wrote:So, the correct way to define an inclusive range is with "+1" except when it's with "nextUp", unless you're talking about the right end of the range where it is inclusive by default and the right way to make it exclusive is with "+1" except when it's with "nextUp"?That's what I call consistent!I completely disagree with your assessment. First, you didn't mention what the range is supposed to do. For example, what primitives should the range have? Are you talking about a built-in type or a library-defined type? etc. There are two places in the language where expression1..expression2 comes into play: when slicing an array, and when iterating with foreach. In both cases the range is discrete with step 1, and so it makes sense to discuss that when expression1..expression2 is being talked about. Now you can't just silently redefine what you mean by range and then claim inconsistency. If you want to make a case, please state clearly what are you talking about. Nobody can be consistent with a definition that doesn't exist.I think what Jerome is getting at is that we could be getting more mileage out of the xpr1..xpr2 syntax. It would be useful syntax for more than just integral, dense ranges in foreach and slices. The equivalents I've used or seen in Ruby, Python and Matlab are more versatile than D's. Perhaps that can't be translated in any useful way to a static language like D, I dunno. But it leaves one with the feeling that D's slice literals are underpowered and that the case range thing is just plugging a hole in a dilapidated boat rather than building us a nice new sleek yacht.
Jerome -- mailto:jeber...@free.fr http://jeberger.free.fr Jabber: jeber...@jabber.fr
signature.asc
Description: OpenPGP digital signature