Post Reply 
EDITLIST in CAS program
10-11-2015, 07:43 AM (This post was last modified: 10-11-2015 08:05 AM by StephenG1CMZ.)
Post: #4
RE: EDITLIST in CAS program
Actually, I wonder whether that should be a bug?
Using L1 := EDITLIST(L1)
Looks like a useful syntax for those times you want to edit a list and keep the original:
L2 := EDITLIST(L1)

If EDITLIST (L1) always changes L1, that last line would make
L2 = L1 = edited
Whereas
L2 = edited L1 =Original
Would be it's obvious meaning without looking up EDITLIST's spec.

So for readability of the source code, I would suggest EDITLIST should not automatically edit the list given as a parameter, though if no destination list is specified it should default to doing so).

A potential downside is that that might be less efficient, but it avoids
L2:=EDITLIST(L1) editing L1 when you might not expect it to.
If doing this is considered too wasteful given that on many occasions you will be editing back to the same list,
I would suggest EDITLIST should not be assignable - the corresponding code then becoming:
EDITLIST (L1); // no L2 makes it clear what is being edited
Or
L2:=L1; //keep original
EDITLIST (L2); // change copy
L2:=EDITLIST (L1) // could give syntax error to avoid confusion


I would also like to suggest EDITLIST should have an optional READONLY parameter (alternatively: a VIEWLIST command) for those times when you want to browse a list without changing it.
See for example how I use it in Version 0.3 of my Z EDITOR (select Searchall then View, and see how awkward the editing can look before my program implements search-and-replace). Having a readonly setting would be much neater.

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
EDITLIST in CAS program - salvomic - 05-18-2015, 08:01 PM
RE: EDITLIST in CAS program - Joe Horn - 05-20-2015, 05:48 AM
RE: EDITLIST in CAS program - salvomic - 05-20-2015, 07:01 AM
RE: EDITLIST in CAS program - StephenG1CMZ - 10-11-2015 07:43 AM



User(s) browsing this thread: 2 Guest(s)