Re: deepening listed subscripting
- Posted by CChris <christian.cuvier at agriculture.gouv.fr> Apr 28, 2006
- 459 views
Jeremy Peterson wrote: > > D. Newhall wrote: > > > > Antonio Alessi wrote: > > > > > (snip stuff from Elliott) > > > > > > Just one correction, since the confusion looks to be contagious. > > > > > (snip) > > > > There's the biggest fault with your proposal. If experienced Euphoria > > programers > > are confused about how this would work how would newcomers understand this? > > Syntactic simplicity shouldn't take precedence over ease of comprehension. > > I agree. It's just too confusing. Added to that, I see no real need for a > change like this. How will it make using Eu easier, or faster, or better? > > Jeremy It will on all three counts, perhaps after some adjustments. If what you type is closer to how you represent what you want to achieve, then the language is easier to use. That's how I would define "easier" in this context. In the case at hand, you want to extract some pieces of a string to build up another one. For this purpose, myString[7,2..5,1] is certainly easier than myString[7]&myString[2..5]&myString[1]. At the same time, it will save typing and probably avoid some silly bugs. These take longer than any loss of performance you can think of because of the new syntax - I doubt there's any. So yes, it will make Euphoria faster. Being spared repetition of meaningful, hence longer variable names makes the language better indeed because the penalty for a programmer to use easy to understand names will be alleviated a bit, and because of the clearer code. To avoid confision, I had been suggesting to keep repeated indices to denote different subscripting levels, hence the idea of putting a list of indices and slices inside the same pair of brackets. Of a more general usefulness would be to have a special symbol stand for the left hand side of an assignment. '_' looks like a good cancicate to me. So, to retain only a few characters of a string, you'd code: some_lengthy_name[with_indexes][and_more]=_[7,2..5,1] Rewrite this using the current state of the language, and you'll be convinced I think. This feature is easy to implement in the source, and has a wider range of uses (how many times did you write: something=append(something,else)? Yet another pita, only second to the namespace system needing rethinking. By the way, Rob: you say that you don't want to open that can because "few people use it anyway". Perhaps "few people use it" because of these problems that have been precisely discussed at length here. CChris