kristopolous / TickTick

JSON in your Bash scripts

Home Page:http://9ol.es/TheEmperorsNewClothes.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The implementation of push and pop need to change to be more easily encapsulated in double quotes

kristopolous opened this issue · comments

echo "Stack.pop()" doesn't work as expected.

After much consideration I've determined that this isn't possible without a fundamental rearchitecting

it's worth noting that if someone can come up with modifying in-shell variables inside of double quotes I'm open to re-opening this.

A few notes:

  • $(...) doesn't work because () is a subshell. You can't hoist modified variations back up.
  • There may be a coproc way of doing this, where the coproc acts a poor-mans data-store over a unix-pipe. This is quite elaborate for solving such a thing as this.
  • (( )) accepts lists but it is limited to something called the "arithmetic" operators which means you can't do function calls
  • There is a way of doing this with traps but again, hijacking the signalling system is a pretty unusual side-effect for such a feature.
  • As far as I know, there is no ${ ... } syntax that allows arbitrary in-shell code to be run. If this can be figured out that would be great.

Anyway, again if you can find a way that is proportional in complexity and overhead to the feature, I'd be happy to do it.