February 19, 2004 Re: A Suggestion: Negative array subscripts | ||||
---|---|---|---|---|
| ||||
Posted in reply to larry cowan | larry cowan wrote:
[...]
> Is a $ inside [] the same everywhere?
Not to forget those who use overloading with opIndex and OpSlice. Now overloading with opDollar is a must. But is tehre always sense in it?
So long.
|
February 19, 2004 Re: A Suggestion: Negative array subscripts | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | no, opDollar is no must. if the object has a .length property, then opDollar just returns that value. and thats it. don't make it too generic when you don't want it to be.. "Manfred Nowak" <svv1999@hotmail.com> schrieb im Newsbeitrag news:c12o1v$odi$1@digitaldaemon.com... > larry cowan wrote: > > [...] > > Is a $ inside [] the same everywhere? > > Not to forget those who use overloading with opIndex and OpSlice. Now overloading with opDollar is a must. But is tehre always sense in it? > > So long. |
February 19, 2004 Re: A Suggestion: Negative array subscripts | ||||
---|---|---|---|---|
| ||||
Posted in reply to Roberto Mariottini | i have it here.. it's altgr-^ "Roberto Mariottini" <Roberto_member@pathlink.com> schrieb im Newsbeitrag news:c12i6v$dl1$1@digitaldaemon.com... > In article <c12eth$79s$1@digitaldaemon.com>, J Anderson says... > > > [...] > >How do you type ° efficiently with a standard 101 us keyboard? > > <irony> > Simply buy an european keyboard, keyboards nowadays are cheap. > </irony> > > Ciao > > 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. > > |
February 19, 2004 Re: A Suggestion: Negative array subscripts | ||||
---|---|---|---|---|
| ||||
Posted in reply to Roberto Mariottini | what about ¦ ? or @ or # ? or § or ¬ or ¢ .. wich ones are common? i have §°+¦"@*#ç°%§&¬/|(¢)=?'´`^~[]$}£{,;.:-_<>\ thats my set:D (combinations with shift, and altgr, and with nothing else) "Roberto Mariottini" <Roberto_member@pathlink.com> schrieb im Newsbeitrag news:c12i6v$dl1$1@digitaldaemon.com... > In article <c12eth$79s$1@digitaldaemon.com>, J Anderson says... > > > [...] > >How do you type ° efficiently with a standard 101 us keyboard? > > <irony> > Simply buy an european keyboard, keyboards nowadays are cheap. > </irony> > > Ciao > > 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. > > |
February 19, 2004 Re: A Suggestion: Negative array subscripts | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | Derek Parnell wrote:
>
> I tend to agree with you on this Matthew. However the concept of a token that signifies a reference to the last element is still a useful idea. Off the top of my head, I suggest the Regular Expression symbol '$', such that a[$] refers to the last element. Thus things like a[4..$] and a[$-4..$-2], and a[$-var] would all be valid.
Why a token? I'd prefer C++-style iterator semantics here, and possibly add properties begin, end, rbegin, and rend. I was planning on doing something like this using standalone functions anyway.
Sean
|
February 19, 2004 Re: A Suggestion: Negative array subscripts | ||||
---|---|---|---|---|
| ||||
Posted in reply to Roberto Mariottini | Roberto Mariottini wrote: > <irony> > Simply buy an european keyboard, keyboards nowadays are cheap. > </irony> Yup, i find the european layout quite sane, except for Italian which doesn't hold to the more common european layout. > 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. -eye |
February 19, 2004 Re: A Suggestion: Negative array subscripts | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | On Thu, 19 Feb 2004 13:00:32 -0800 (02/20/04 08:00:32) , Sean Kelly <sean@ffwd.cx> wrote: > Derek Parnell wrote: >> >> I tend to agree with you on this Matthew. However the concept of a token that signifies a reference to the last element is still a useful idea. Off the top of my head, I suggest the Regular Expression symbol '$', such that a[$] refers to the last element. Thus things like a[4..$] and a[$-4..$-2], and a[$-var] would all be valid. > > Why a token? I'd prefer C++-style iterator semantics here, and possibly add properties begin, end, rbegin, and rend. I was planning on doing something like this using standalone functions anyway. > 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? -- Derek |
February 19, 2004 Re: A Suggestion: Negative array subscripts | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | 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. Someone famous (Einstein?) once said "Things should be as simple as possible, but not too simple." -- Derek |
February 19, 2004 Re: A Suggestion: Negative array subscripts | ||||
---|---|---|---|---|
| ||||
Posted in reply to davepermen | davepermen wrote:
> if the object has a .length property, then opDollar
> just returns that value. and thats it.
As the standard .length property can be redefined this approach might be too simple.
So long.
|
February 20, 2004 Re: A Suggestion: Negative array subscripts | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | What about a new keyword, 'last'? "Derek Parnell" <Derek.Parnell@Psyc.ward> wrote in message news:opr3m4cktxdeu3pf@news.digitalmars.com... > On Thu, 19 Feb 2004 13:00:32 -0800 (02/20/04 08:00:32) > , Sean Kelly <sean@ffwd.cx> wrote: > > > Derek Parnell wrote: > >> > >> I tend to agree with you on this Matthew. However the concept of a token that signifies a reference to the last element is still a useful idea. Off the top of my head, I suggest the Regular Expression symbol '$', such that a[$] refers to the last element. Thus things like a[4..$] and a[$-4..$-2], and a[$-var] would all be valid. > > > > Why a token? I'd prefer C++-style iterator semantics here, and possibly add properties begin, end, rbegin, and rend. I was planning on doing something like this using standalone functions anyway. > > > > 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? > > -- > Derek |
Copyright © 1999-2021 by the D Language Foundation