Knuckle Cracker

Knuckle Cracker => Support => Topic started by: kajacx on March 26, 2017, 02:24:05 PM

Title: [Bug] --? (ref delete) doesn't do anything and compiles without error
Post by: kajacx on March 26, 2017, 02:24:05 PM
After debugging a code for 15 minutes, I found out that the ref delete operator "--?" doesn't do anything! It even compiles without warning. It even leaves the vaariable name on stack. How did this happen?

Thankfully, you can write "--!" which is certaily better for people with OCD (and with a sence of order in general):

Operation    Normal       Reference
Read         <-varname    <-!
Write        ->varname    ->!
Exists       -?varname    -?!
Delete       --varname    --!


I have already changed the wiki (https://knucklecracker.com/wiki/doku.php?id=prpl:refdelete) and added the warning there, however not everyone will read the wiki or will go to the CRPL wiki for things like this (like I did).

So, can the operator "--?" start doing what it should, or at least throw a compilation error "--? is obsolete, use --! for ref delete instead".

If you want to try it out on your own:

"Test" ->test

#"test" --? #doesn't work
"test" --! #works

"StackSize: " StackSize 1 sub Trace2

"Is it defined?" -?test Trace2


By the way the exact same thing happens with global ref delete, "--?*" doesn't do anything (and still compiels fine), while "--!*" is the actual gobal ref delete.
Title: Re: [Bug] --? (ref delete) doesn't do anything and compiles without error
Post by: GoodMorning on March 26, 2017, 06:35:42 PM
--? is a valid command, being a delete for a variable '?'.

Mention can be made on the wiki, but...
Title: Re: [Bug] --? (ref delete) doesn't do anything and compiles without error
Post by: kajacx on March 27, 2017, 09:29:58 AM
Good idea to edit the wiki (already done), but it would still be a good idea to give people a warning when they use it: you probably didn't want to delete a variable named "?", and wanted to use a ref delete instead.