February 20, 2004
"Derek Parnell" <Derek.Parnell@Psyc.ward> wrote in message news:opr3m4qie8deu3pf@news.digitalmars.com...
> On Thu, 19 Feb 2004 14:08:20 +1100 (02/19/04 14:08:20)
> , Matthew <matthew.hat@stlsoft.dot.org> wrote:
>
> >> On Thu, 19 Feb 2004 09:53:51 +1100 (02/19/04 09:53:51)
> >> , Matthew <matthew.hat@stlsoft.dot.org> wrote:
> >>
> >> >
> >> > "Derek Parnell" <Derek.Parnell@No.Spam> wrote in message
>
> [snip]
> >>
> >> So yes, the '$' token is semantically equivalent to '<ARRAY>.length'
> >> when
> >> detected inside a slice expression; it is just a shorthand notation.
But
> >> that is the whole point - it is a useful shorthand notation.
> >
> > This specific case is covered by the implicit end, in syntax that was proposed a long time ago
> >
> >    xyzzy = v_Customer_Hash_Table[lPosition .. ]
> >
> > In the same way, an implicit start would also be available
> >
> >    xyzzy = v_Customer_Hash_Table[ .. 10]
> >
>
> Yes, I remember this, and it is a common suggestion in other languages too. My issue with this idea is that it encourages mistakes to be made. An omitted token is ambiguous - it could be a mistake or not a mistake, and both are syntactically valid. I'm suggesting a compromise between brevity and easy-of-use.

Good point

> Someone famous (Einstein?) once said "Things should be as simple as
> possible, but not too simple."

I think it was Einstein


February 20, 2004
Derek Parnell wrote:
> 
> I didn't literally mean a one-character-non-alphabetic thing. Anything that looks like a 'special' syntax element would surfice, and that could be a keyword or an operator-like character. I'm not wedded to the '$' symbol or anything else in particular.
> 
> However, if the worth of expending the energy in putting this idea in to a compiler is justified, whatever token is decided on, it should be as short as possible and very easily recognised by a human reader. We are trying to make life easier for coders, yes?

True enough.  In that case I have a request.  Support for reverse copying (and perhaps slicing?).  Something along these lines:

char[] a = "abc";
char[3] b;
b[] = a[2..-1];

In this case, b should contain "cba."  Right now, D doesn't support this idea at all, and even if it did, there's no way to refer to the element before the first element (ie. rend).  Reverse-slicing could be neat too, but that sounds like it would have some technical issues to overcome.


Sean

February 20, 2004
Just as a clarification, I thought this might be applicable because it would be easiest done using a new symbol, ie.

char[] a = "abc";
char[3] b;
b = a[!0..!3];

In this case, the '!' signifies that the string is to be indexed in reverse.


Sean

February 20, 2004
Derek Parnell wrote:

[...]
> Someone famous (Einstein?) once said "Things should be as simple as possible, but not too simple."

"Look, I made them as simple as possible, but no simpler."
-- Albert Einstein after beeing accused to have too complex models
http://www.artima.com/intv/simplest2.html

Therefore this aphorism is not well suited in this case.

So long.

February 20, 2004
On Fri, 20 Feb 2004 04:18:52 +0100 (02/20/04 14:18:52)
, Manfred Nowak <svv1999@hotmail.com> wrote:

> Derek Parnell wrote:
>
> [...]
>> Someone famous (Einstein?) once said "Things should be as simple as
>> possible, but not too simple."
>
> "Look, I made them as simple as possible, but no simpler."
> -- Albert Einstein after beeing accused to have too complex models
> http://www.artima.com/intv/simplest2.html
>
> Therefore this aphorism is not well suited in this case.
>
> So long.
>

Maybe you are right. I was thinking along the lines that a '$' is a short recognisable symbol and is thus is it a simple as possible (within the 'helping others' constaint) but that an omitted token would be way too simple.

Whatever. I think we have all made our points understood. Now if only we could agree ;-D

-- 
Derek
February 20, 2004
On Fri, 20 Feb 2004 10:56:38 +1100 (02/20/04 10:56:38)
, Matthew <matthew.hat@stlsoft.dot.org> wrote:

> What about a new keyword, 'last'?
>
>

The issue I have with using things that look like identifiers (a.k.a. keywords) is that it takes away yet another 'word' away from our identifer namespace. We already have many keywords that are prevent an identically named identifier from being used in the same context - do we really need any more? Maybe - maybe not. If the loss of a word is worth the gain then fine.

Then there is the 'English' orientation of many of our programming languages. Sure, English maybe the new lingua franca, but it adds another hurdle to people who's first language is not English. Its too late to do anything about this of course, (and in anycase some human language would more than likely have to be used) but do we need another English keyword in D? As an exercise to demonstrate this, I like to get an experienced coder to 'translate' any program of her choice such that all keywords are turned in to gibberish and then get somebody else to review the translated code. Even with a 'dictionary' it is a frustrating and humourous exercise.

But I digress...I'm unable to form a judgement in this specific case, as to whether '$', 'last' or something else is the best alternative. However, the concept is still a good one, IMHO.

-- 
Derek
February 20, 2004
Matthew wrote:

> What about a new keyword, 'last'?

I would vote for that. But not for the arguments that come up so far.

There is no other way to refer to the last element in anonymous slices and therefore the use of this keyword should be restricted to those anonymous slices.

So long.
February 20, 2004
> > P.S.: If you don't understand, look to the newsgroup archives, where I please to not use Alt-126 (~) because it's not present in most european keyboards.
>
> MOST??? I had seen German, French, and Finnish have it. Even the Israeli and the Russian keyboards do, IIRC.

The only european keyboard without (~) is Italian.
But there are TWO Italian keyboard layouts in Windows,
and the second one actually has (~) and (`).
You should try to switch to "Italian (142)" layout.

The differences are: < Character : Italian  /  Italian (142) >
@ : AltGr-Ò(;)  /  AltGr-Q
# : AltGr-À(')  /  AltGr-3(#)
[ : AltGr-È([) / AltGr-8
] : AltGr-+(]) / AltGr-9
{ : AltGr-Shift-È([)  /  AltGr-7
} : AltGr-Shift-+(])  /  AltGr-0
~ : ...  /  AltGr-+(])
` : ...  /  AltGr-Ù(\)


February 20, 2004
"Manfred Nowak" <svv1999@hotmail.com> wrote in message news:c140u7$1em$1@digitaldaemon.com...
> Matthew wrote:
>
> > What about a new keyword, 'last'?
>
> I would vote for that. But not for the arguments that come up so far.
>
> There is no other way to refer to the last element in anonymous slices and therefore the use of this keyword should be restricted to those anonymous slices.

Interesting point. :)


February 20, 2004
> P.S.: If you don't understand, look to the newsgroup archives, where I please to not use Alt-126 (~) because it's not present in most european keyboards.

(ups, the first reply went one level down ...)

The only european keyboard without (~) is Italian.
But there are TWO Italian keyboard layouts in Windows,
and the second one actually has (~) and (`).
You should try to switch to "Italian (142)" layout.

The differences are: < Character : Italian  /  Italian (142) >
@ : AltGr-Ò(;)  /  AltGr-Q
# : AltGr-À(')  /  AltGr-3(#)
[ : AltGr-È([) / AltGr-8
] : AltGr-+(]) / AltGr-9
{ : AltGr-Shift-È([)  /  AltGr-7
} : AltGr-Shift-+(])  /  AltGr-0
~ : ...  /  AltGr-+(])
` : ...  /  AltGr-Ù(\)