FolkComputer / folk

🎁 Physical computing system.
https://folk.computer
Apache License 2.0
75 stars 4 forks source link

Replace all occurrences of "Commit" with "Hold" #161

Closed cwervo closed 1 month ago

cwervo commented 1 month ago
find . -type f \( -name "*.tcl" -o -name "*.folk" -o -name "*.md" -o -name "*.js" \) \
  -not -path "*/vendor/*" \
  -not -path "*/.git/*" \
  -exec sed -i '' \
    -e 's/Commit/Hold/g' \
    -e 's/commit/hold/g' \
    -e 's/COMMIT/HOLD/g' \
    -e 's/Commits/Holds/g' \
    -e 's/commits/holds/g' \
    -e 's/COMMITS/HOLDS/g' \
    -e 's/Committed/Held/g' \
    -e 's/committed/held/g' \
    -e 's/COMMITTED/HELD/g' \
  {} +
cwervo commented 1 month ago

Note: works perfectly fine after running for a while/using a few programs on folk-cwe at home, so I think we're good.

osnr commented 1 month ago

Cool -- I like how this looks even more than expected. Does this break all printed programs that use Commit? Can we do something with backward compatibility like we do with Display:: functions (and/or should we just do the find and replace on printed programs also?)?

cwervo commented 1 month ago

Good point, when I get in later I'll write a deprecation Wish

l3gacyb3ta commented 1 month ago

maybe something like

When /something/ commits /x/ {
  # maybe flash it like errors? or add a title?
}
cwervo commented 1 month ago

I thought about moving warnDeprecated

https://github.com/FolkComputer/folk/blob/fde512c916bfe6fe6c30ec9bff7b4f410bbc7c86/virtual-programs/display.folk#L1711-L1716

into a shared file but the implementation for this deprecation is different enough (being in main.tcl) that I don't think the abstraction is worth it right now.

I'll test this out on my home system too.

IMG_1862

cwervo commented 1 month ago

test to add ...

# V1:
# TODO: test this on folk-cwe, merge :-)
Commit { Claim $this has seen 0 committed boops }
Hold { Claim $this has seen 0 held boops }

Every time there is a committed boop & $this has seen /n/ committed boops {
  Commit { Claim $this has seen [expr {$n + 1}] committed boops }
}

When the clock time is /t/ {
  Commit {
    Claim there is a committed boop
  }
}

When $this has seen /n/ committed boops {
  Wish $this has halo message "committed boops: $n"
}
ppkn commented 1 month ago

held boops is increasing but committed boops aren't showing up at all

# V1:
# TODO: test this on folk-cwe, merge :-)
Commit { Claim $this has seen 0 committed boops }
Hold { Claim $this has seen 0 held boops }

Every time there is a committed boop & $this has seen /n/ committed boops {
  Commit { Claim $this has seen [expr {$n + 1}] committed boops }
}

Every time there is a held boop & $this has seen /n/ held boops {
  Hold { Claim $this has seen [expr {$n + 1}] held boops }
}

When the clock time is /t/ {
  Commit {
    Claim there is a committed boop
    Claim there is a held boop
  }
}

When $this has seen /n/ committed boops {
  Wish $this has halo message "committed boops: $n"
  puts "this has $n committed boops"
}

When $this has seen /n/ held boops {
  Wish $this has halo message "held boops: $n"
}
cwervo commented 1 month ago

Turns out this works! The bug was that Hold and Commit are literally equivalent so I had to add keys to them to not have them squash each other

# ================================
# V0: With halo messages
# ================================
Commit c { Claim $this has seen 0 committed boops }
Hold h { Claim $this has seen 0 held boops }

Every time there is a committed boop & $this has seen /n/ committed boops {
  Commit c { Claim $this has seen [expr {$n + 1}] committed boops }
}

Every time there is a held boop & $this has seen /n/ held boops {
  Hold h { Claim $this has seen [expr {$n + 1}] held boops }
}

When the clock time is /t/ {
  Commit c {
    Claim there is a committed boop
  }
  Hold h {
    Claim there is a held boop
  }
}

When $this has seen /n/ committed boops {
  Wish $this has halo message "    committed : $n"
  puts "this has $n committed boops"
}

When $this has seen /n/ held boops {
  Wish $this has halo message "           held  : $n"
  puts "this has $n held boops"
}

IMG_3395

Merging shortly