Re: deepening listed subscripting
- Posted by "Elliott S. de Andrade" <quantum_analyst at hotmail.com> Apr 26, 2006
- 498 views
>From: Antonio Alessi <guest at RapidEuphoria.com> >Reply-To: EUforum at topica.com >To: EUforum at topica.com >Subject: Re: deepening listed subscripting >Date: Wed, 26 Apr 2006 12:08:48 -0700 > >posted by: Antonio Alessi <a.admin at myway.it> > >Jeremy Peterson wrote: > > > > I think it's better to have it that way. That is the way I'd expect it >to be. > > > > Simple? Euphoria is supposed to be a easy language, according to Rob. >Adding > > stuff like this is, I think going to confuse people when they see in a >line: > > > > &[5..9][27..$] It doesn't look like regular eucode. Plus I don't think > > it's needed. A change like this will save a little typing, but only if >your' > > in the habit of using long variable names or something. Just something >to think > > about... > > > > Jeremy > > >Hello Jeremy, > >if &[5..9][27..$] do confuse people, I think it's better those people don't >begin programming at all. Euphoria is much more complex than this, although >is supposed to be an easy language, or it wouldn't be so powerful. > Ah, but it seems you can still be confused. You see, s[5..9][27..$] currently means nothing. But what if, for example, we had s = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {16, 17, 18, 19, 20}, {21, 22, 23, 24, 25}}, then with your shortcut [2][4..5] would be {6, 7, 8, 9, 10, {16, 17, 18, 19, 20}, {21, 22, 23, 24, 25}} but if you used regular old eucode, s[2][4..5] is {9, 10}. Now, you may have very well known that when you wrote x = s[1] & '3' & [2][4..5] that you wanted x = {1, 2, 3, 4, 5, '3', 6, 7, 8, 9, 10, {16, 17, 18, 19, 20}, {21, 22, 23, 24, 25}}. But if someone else is reading that, and all they heard about was the meaning of s[2][4..5] that we currently have (which is not all too common with arrays), what would they think the result would be? I would expect x = {1, 2, 3, 4, 5, '3', 9, 10} as a best guess. Certain shortcuts like $ instead of length(var) or &= made sense.... Some just make things more confusing. Dangling subscripts are not a good thing. As someone else mentioned, what happens when there is more than one sequence? What if the second variable is an atom; should you ignore it? What if you later change it to a object; would that cause an error? What if it didn't cause an error, and you accidently had a sequence in that variable; how hard would it be to find that bug? What if I put parentheses around things; which comes first? Can I do something like x = s[2] * [4] and expect it to make sense? Certainly it looks somewhat odd to be doing func(x[2], [5][3], [6]), doesn't it... >In my opinion, easy does not mean elementary but plain and well structured, >thus allowing to perform very complex actions with ease. >Basic "was" much more simple than Euphoria, but could not reach the half >of the possible EU solutions with the same minimum amount of program lines. > >However nobody is compelled to use unfamiliar formulas, even if I believe >it >could deal with a typical problem of the first time: > "That is (not) the way I'd expect it to be.". >Truly this enhancement that I suggested is simpler than others in this >forum >and I don't understand why so much reactions could arise for. > >I could also ask what "regular eucode" means for you, but I don't. >I can just conclude quoting the Rob's answer, since this was not on >Euforum: > >"Thanks, I'll consider it. >I hadn't thought of that before." > > >antonio > ~[ WingZone ]~ http://wingzone.tripod.com/