Commit 222271a0b886e047915acccf3a556eaa43248f7b

Authored by Shrikant Sharat
1 parent 9d1b71736a

Memoization is not possible in a sane way.

The memoized results of these functions cannot be saved in a global hash map,
becuase these functions are always run in a subshell. Changes to variables in
the subshell do not reflect in the main shell instance. We'd have to resort to
use the `$REPLY` ways returning the result from these functions, if they were to
be memoized. But that way of doing things sucks. Totally unreadable. So, just
not memoizing.

Showing 1 changed file with 1 additions and 8 deletions Side-by-side Diff

... ... @@ -110,14 +110,8 @@ antigen-update () {
110 110 -antigen-get-clone-dir () {
111 111 # Takes a repo url and gives out the path that this url needs to be cloned
112 112 # to. Doesn't actually clone anything.
113   - # TODO: Memoize?
114   -
115   - # The url given.
116   - local url="$1"
117   -
118   - # Echo the full path to the clone directory.
119 113 echo -n $ADOTDIR/repos/
120   - echo "$url" | sed \
  114 + echo "$1" | sed \
121 115 -e 's./.-SLASH-.g' \
122 116 -e 's.:.-COLON-.g' \
123 117 -e 's.|.-PIPE-.g'
... ... @@ -126,7 +120,6 @@ antigen-update () {
126 120 -antigen-get-clone-url () {
127 121 # Takes a repo's clone dir and gives out the repo's original url that was
128 122 # used to create the given directory path.
129   - # TODO: Memoize?
130 123 echo "$1" | sed \
131 124 -e "s:^$ADOTDIR/repos/::" \
132 125 -e 's.-SLASH-./.g' \