Page 1 of 1

can't remember how to do this

Posted: Wed Apr 26, 2023 9:08 pm
by dunbarx
There is a chunk hierarchy in LC that did not exist in HC. This has been discussed here but I cannot find anything about it.

It involves using what LC considers a "large" chunk and a "small" chunk. One cannot:

Code: Select all

put foo into line 3 of item 2 of temp
because an item is "smaller" than a line. LC barks with "bad chunk order (must be small to large)"

I had thought that we solved this long ago by placing the "small" chunk in parens:

Code: Select all

put foo into line 3 of (item 2 of temp)
and even believe that in the past this worked. But it does not now. LC complains that I have a "bad destination".

No problem with an extra level of evaluation:

Code: Select all

get item 2 of temp
put foo into line 3 of it
But there was once a better way...

Craig

Re: can't remember how to do this

Posted: Wed Apr 26, 2023 9:22 pm
by FourthWorld
You can swap the itemDel and lineDel characters.

The descending chunk order enforcement has been there as long as I can remember.

Re: can't remember how to do this

Posted: Thu Apr 27, 2023 1:27 am
by mwieder
...and been a pain for about that long.
I've lost count of the number of times it's bitten me, and then I have to brain my way out.
"bad destination" is pedantically correct, but doesn't really give much context.

Re: can't remember how to do this

Posted: Thu Apr 27, 2023 3:15 am
by dunbarx
Richard, Mark.

Thanks for getting back to me, but am I just wrong in remembering that this was resolved by isolating the smaller chunk with parens?

I could swear it was, and that the discussion was happily resolved and put on the shelf. I even recall that official humans from the mothership stated that there need not be any revision to the way LC works (as opposed to HC) since the fix was so simple.

That fix meant inserting parentheses in the right spot. That made the engine evaluate the smaller chunk in a way that did not unnerve the chunk hierarchy.

Craig

Re: can't remember how to do this

Posted: Thu Apr 27, 2023 4:12 am
by FourthWorld
It would seem logical that the parens would address the need, but I've never used that myself.

If you turn up anything on this (an earlier version it worked in, team comment, etc) please let us know.

Re: can't remember how to do this

Posted: Thu Apr 27, 2023 5:24 am
by LCMark
dunbarx wrote:
Thu Apr 27, 2023 3:15 am
Thanks for getting back to me, but am I just wrong in remembering that this was resolved by isolating the smaller chunk with parens?

I could swear it was, and that the discussion was happily resolved and put on the shelf. I even recall that official humans from the mothership stated that there need not be any revision to the way LC works (as opposed to HC) since the fix was so simple.

That fix meant inserting parentheses in the right spot. That made the engine evaluate the smaller chunk in a way that did not unnerve the chunk hierarchy.
You are mis-remembering I'm afraid - expressions surrounded by parentheses are never containers - so the trick only works for fetching values, not storing them.

Re: can't remember how to do this

Posted: Thu Apr 27, 2023 3:39 pm
by dunbarx
LCMark.

If I am not afraid of my scrambled memory, there is no reason for you to be.

So an extra level of evaluation is the only way to circumvent the large-to-small chunk hierarchy. OK.

I may see if a "do" construction will work, since that gives that extra evaluation. But that may end up being rather less readable than simply placing the smaller chunk in a variable, as you say, merely for the privilege of keeping to a single line.

Craig