stevehalliwell / ulox

A bytecode interpreted scripting language for games in Unity.
MIT License
24 stars 0 forks source link

Unpleasant shapes #227

Open stevehalliwell opened 9 months ago

stevehalliwell commented 9 months ago

There are two code shapes we encounter that are unpleasant and non-obvious to skim over.

if(need a)
{
   do a thing

  //because need a d we also need b
  if(need b)
  {
    do b thing

   //because we need a and need b, we also need c?
   //etc.
  }
}

and

var resA = FuncA(something);
var resB = FuncB(resA);
var resC = Funcc(resB);
//etc.

//or worse
var lastRes = FuncN(FuncN1(FuncN2 ... );

They are a conflict between location where logic must be placed and the implication of scoping.

Sequences of operations that in c# we might use select with lambdas. f# might use |>.