<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.16.1">
</HEAD>
<BODY>
<BR>
On Sun, 2008-03-30 at 16:41 -0300, Leandro Lucarella wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
<BR>
<TT><FONT COLOR="#000000">In python this is array[5:-1], which seems a lot nicer to me...</FONT></TT><BR>
<BR>
<TT><FONT COLOR="#000000">I hope D some can do array[5..-1], array[..-4], array[..], etc. a la</FONT></TT><BR>
<TT><FONT COLOR="#000000">Python.</FONT></TT><BR>
</BLOCKQUOTE>
<BR>
Fwiw, this is a feature Python borrowed from Perl. In Perl, a negative index means "array length - Y". But 5..-1 doesn't seem as pretty as 5.. I mean, if I didn't tell it where to go, where else is it going to go? Inference is nice, we seem to all agree...I don't hear anyone complaining about not having to specify their types in for-each loops...so why not infer the beginning or end of the array, I mean...<BR>
<BR>
if i say array[..5], where was I expecting to start other than the beginning?<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<BR>
<TT><FONT COLOR="#737373">> So it only buys you the luxury of not having to type $ in one very</FONT></TT><BR>
<TT><FONT COLOR="#737373">> special case. In my view, that makes keeping it more consistent than</FONT></TT><BR>
<TT><FONT COLOR="#737373">> dropping it. (And come on - it's only one character!)</FONT></TT><BR>
<BR>
<TT><FONT COLOR="#000000">Yes, only 1 character but it looks like an ugly hack to me. '$' has no</FONT></TT><BR>
<TT><FONT COLOR="#000000">meaning except in array slices, and what not necessary anyway. I know it's</FONT></TT><BR>
<TT><FONT COLOR="#000000">hard (impossible?) to get rid of it now, but I wanted to say it =)</FONT></TT><BR>
</BLOCKQUOTE>
<BR>
I wouldn't think it'd be impossible. D 2.0 is considered unstable. Walter seems to be being careful not to make people too angry by breaking their code. My thoughts on that is "If the code you were writing was important, it shouldn't have been in D 2 anyway since D 2 isn't done." Although I appreciate that digital mars provides a functional implementation of a totally in-development language specification. That's pretty cool beans. People should be glad, not bitch about stuff breaking. You rarely get that type of luxury in other languages.<BR>
<BR>
Cheers,<BR>
Scott S. McCoy
</BODY>
</HTML>