Skip to content(if available)orjump to list(if available)

Improvements to OCaml code editing: the basics of a refactor engine

panglesd

Very cool!

Does it replace identical expressions in the same scope? Like:

    let tau = 3.14 +. 3.14
becomes

    let pi = 3.14
    let tau = pi +. pi
?

EDIT: Or even crazier with function:

    let _ = (x + 1) + (y + 1)
becomes

    let plus_one a = a + 1
    let _ = (plus_one x) + (plus_one y)

(I ask this just out of curiosity. Even the "simpler" version is very impressive!)

nukifw

Nop, for the moment, we try to not "infer user usages"! But if you extract an expression with variable, there will be, obviously, not be repeated:

    let tau =
      let pi = 3.14 in 
      pi + pi
if we extract `pi + pi` it will lead (if you do not give any concrete name) to the following code:

    let fun_name1 pi = 
       pi + pi

    let tau = 
       let pi = 3.14 in 
       fun_name1 pi

dionedave

[dead]

nukifw

PRs are mentioned at the end of articles. It is possible to `pin` repositories locally on their different branches to experiment with them locally!

dionedave

[flagged]