vipsi - known bugs
Author: kio@little-bat.de
Keywords: vipsi shell script interpreter programming

# vipsi - shell and script language

## known bugs

### deleting variables in use

with some maliciosness it is possible to delete variables which are currently in use. this will crash vipsi. this problem is probably solved in the next version of vipsi after version 1.0.

        var a;
        proc bummer() { del a; return "haha!" }
        a = bummer();

### operators and functions with side effects

in an ideal world an expression is made up out of terms which modify nothing but their result value, which they are expected to modify.

but there are some operators which modify their operands and you will probably every now and then write a procedure which not only returns a result but also modifies some global data directly.

vipsi, and other computer languages, try to avoid unneccessary copying of data. therefore operands and arguments in expressions which simply refer to a variable are not copied for further evaluation, but only a reference to the variable is remembered.

this comes to a problem if the pending variable is modified by the side effect of a procedure or operator later in the expression.

this is not detected for the sake of speed. and it may even be made part of the syntax definition of vipsi! after all most usages this way are either exotic or knowingly abusive.

examples:

#### operator ++ and --

the prefix and postfix operators `++` and `--` modify the referenced variable. they are the bad side of this problem. in addition, prefix `++` and `--` only keep a reference to the just modified variable (postfix can't!) and thus are also the vulnerable side of the problem:

    vipsi> var a = 1
    vipsi> a + ++a    = 4         (not 3)

    vipsi> var a = 1
    vipsi> a + a++    = 3         (not 2)

#### assignment operators = += -= *= /= %= #= ##= etc.

assignment operators deliberately modify their left-side argument, the bad side of our problem, and in addition to that all all modify-and-assign operators also read their value from the referenced variable, making them vulnerable for our problem.

    vipsi> var a = 20
    vipsi> a += (a=4)    = 8       (not 24)

    vipsi> var a={}
    vipsi> a[4]=a[3]=a    = { 0, 0, {0,0,0,0}, {0,0,0,0} }     not:  {0,0,{},{}}