Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for animations that update a line #88

Open
meithecatte opened this issue May 8, 2020 · 1 comment
Open

Support for animations that update a line #88

meithecatte opened this issue May 8, 2020 · 1 comment

Comments

@meithecatte
Copy link

Say you want to modify the code slightly in the next slide:

[](string const &L, string const &R) {
// to
[](string const &L, string const &R) -> bool {

It would be nice if the modified part of the line appeared, instead of the entire line disappearing and appearing again.

(Is this already supported? If so, I missed it in the documentation. If you don't have the time to implement this, but wouldn't mind a PR, I'd appreciate your insight as to how to fit this into the infrastructure of your code)

@meithecatte meithecatte changed the title Support for animations that don't update a line Support for animations that update a line May 8, 2020
@vlsi
Copy link

vlsi commented Jul 3, 2020

One of the questions here is how to make code surfer aware which "words" should go where.
For instance, it might be complicated in case the line is moved and altered at the same time.

It would be nice to be able to specify which words go where.

For instance:

public static void main(String[] args) {
  int x = 2;
  int y = 5;
  assert x + 3 == y * 2;
}

=>

public static void main(String[] args) {
  RecorderRuntime $rr = new RecorderRuntime();
  $rr.powerAssert(
    "x + 3 == y * 2",
    $rr.recordValue(
      $rr.recordValue($rr.recordValue(x, 144) + 3, 146) ==
      $rr.recordValue($rr.recordValue(y, 153) * 2, 155),
      153
    ),
    144
  );
}

Note how x + 3 == y * 2 is still visible on the second source (see $rr.recordValue(x, 144) + 3).

I wonder if the following might work.
Then, the markup can be made less verbose by using Unicode characters (which is way less likely to clash with existing code).

public static void main(String[] args) {
  int x = 2;
  int y = 5;
  assert @@<var_x[x]>@@ + @@<var_plus3[3]>@@ == y * 2;
}
public static void main(String[] args) {
  RecorderRuntime $rr = new RecorderRuntime();
  $rr.powerAssert(
    "x + 3 == y * 2",
    $rr.recordValue(
      $rr.recordValue($rr.recordValue(@@<var_x[x]>@@, 144) @@<var_plus3[+ 3]>@@, 146) ==
      $rr.recordValue($rr.recordValue(y, 153) * 2, 155),
      153
    ),
    144
  );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants