Re: Warning error
- Posted by Bob Elia <bobelia200 at netzero.net> Feb 27, 2007
- 495 views
CChris wrote: > > Bob Elia wrote: > > > > Pete Lomax wrote: > > > > <snip> > > > > > Regards, > > > Pete > > > PS I vote for {}=xxx(), btw, very Eu-like, as I read it as "nothing > > > becomes > > > equal to the result of xxx()" or I suppose if you prefer, "store the > > > result > > > of xxx() in nothing/nowhere". Whereas I never really liked the ~xxx() > > > idea. > > > Plus it ties up nicely with my plans for multiple assignment, and also I > > > always > > > found "{}=" dead easy to type, actually easier/faster than "~" even > > > thought > > > it is three keys(I regularly use) not one(I rarely use). > > > > Hi Pete, > > > > Multiple assignment would be terrific but please don't use braces for this. > > > > I much prefer parentheses; e.g. > > > > }}} <eucode> > > {a, b, c) = somefunc() > > > > -- Using braces makes it look like sequence formation, which it is not: > > > > {d,e,f} = another_func() > > </eucode> {{{ > > > > Also, (I may be nit-picking here) when you say "nothing becomes equal to..." > > as in "{}=xxx()", the empty braces have a very specific meaning, that is, > > "the empty sequence", not "nothing". At least, I find it jarring to look > > at. > > > > Unless, of course, I've misunderstood your intention. ;) > > > > BTW, I take it you are familiar with Daryl Border's implementation of > > multiple assignment called "seqparse" from 2005. > > > > Thanks, > > Bob > > Please don't use parentheses or square brackets. Look at the following code: > }}} <eucode> > x=f > (d,e,c)=something() > </eucode> {{{ > The interpreter will be confused because f is not supposed to have any > arguments, yet the code reads: > }}} <eucode> > x=f(d,e,c)=something() > </eucode> {{{ > Even more irritating, the latter does have a meaning in Eu already, which is > > not the one that was intended. Yes, of course. That slipped by me completely. > > As you can see, replacing parens by square brackets doesn't help, because, > when the comma appears, the interpreter is already subscripting f. > > This leaves us with: > * {...}, my preference, > * |...| : pipes are not often easy to tell from square brackets, and, on non > english keyboards, | and [ are on adjacent keys, calling for more typos. > * <...> : will confuse the interpreter. Remember that it is very myopic, and > has to know at each character how it is going to read that character. It > exceptionally looks ahead one char forth so as to read the slice symbol > or relational operators, but that's nearly all. > * perhaps <<...>> would be acceptable. > * perhaps ;...; would be acceptable. > > So my vote is for curly braces. > > {}=func() doesn't shock me at all. It is an empty sequence of placeholders. > So, no assignment is to take place, since there is no target for assignment. > If {} is okay, then I'd rather not introduce new syntax elements. They might be needed in the future for something else. Agreed? > In my private idEu preprocessor, I use a single _ as placeholder in various > contexts. For instance, I write > }}} <eucode> > a[b[c]][d]=append(_,something) > </eucode> {{{ > where _ resolves to the left hand side. > And > }}} <eucode> > {a,_,c}=f > </eucode> {{{ > if I wish to ignore the second element in the right hand side. I had coded > > the beast so that {}, {_} or _ on the left would all cause no assignment > to take place. > > > Any thoughts? > > CChris Thanks, Bob