Post Reply 
newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
10-02-2017, 02:45 PM
Post: #176
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-09-15]
(10-02-2017 02:07 PM)The Shadow Wrote:  New bug:

If you have a variable with something stored in it, then do CRDIR on the same name, it will overwrite the variable. Probably should throw an error instead.

...Huh. I just noticed that oldRPL does this too. I'm not at all sure it's a good idea.

Sorry for your valuable data lost.
CRDIR is no different from STO, except the object being stored is a newly created directory.
newRPL does have directory overwrite protection in STO to prevent the user from overwriting an entire directory by accident. I just noticed this safeguard is not enabled in CRDIR, now that's something I want to fix.
Variables get overwritten all the time, either by STO or CRDIR. Adding a question "Are you sure you want to overwrite this variable?" every time you STO something would make the calculator pretty much unusable.
If you think about it, no OS will ask for confirmation when a program opens a file for writing. The user-facing application might detect the file as existing and ask the user if he wants to overwrite, not the OS.
In this case, if you are writing a program and you want to let the user know, do something like this:
Code:

«
@@ THIS IS A STO REPLACEMENT THAT DOESN'T OVERWRITE

@@ PUT 1 IF var EXISTS AND 0 IF IT DOESN'T.
IFERR DUP RCL DROP THEN 0 ELSE 1 END

@@ NOW DO SOMETHING ABOUT IT
IF THEN DUP UNQUOTEID →STR " already exists" + DOERR @@ Here UNQUOTEID is just so it looks better in the string
ELSE DROP STO @@ Here DROP is needed because the error in DUP RCL leaves an extra var
END
»

Although this is not too different from using LOCKVAR/UNLOCKVAR on certain variables.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-09-15] - Claudio L. - 10-02-2017 02:45 PM



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