Cubist's first bug report

Mark Wieder mwieder at ahsoftware.net
Mon Jun 6 17:32:34 EDT 2016


Mark-

Thanks so much for adding insight to this discussion. You raise some
very interesting points here.

And I realize the parser is the problem here, so I'd only add that

    function addOneToIndex
      add 1 to sIndex
      return sIndex
    end function

would be an error in functional programming, since the whatShouldThisDo?
and addOneToIndex functions have an unfortunate and easily-fixed side effect.

    variable sIndex
 
    -- no side effects here any more
    command setSIndexTo pNewIndex
        put pNewIndex into sIndex
    end setSIndexTo
 
    -- this is now no longer ambiguous
    command whatShouldThisDo? sInput
      -- this will work with line sIndex
      add char sIndex of line sIndex of sInput to tSum
      setSIndexTo sIndex+1

      -- this will work with line sIndex + 1
      setSIndexTo sIndex+1
      add char sIndex of line sIndex of sInput to tSum
    end command






More information about the use-livecode mailing list