3 ms·
Sounds like a cool tool. The ability to write rewrites as regular code fragments with metavariables feels like some ideas I've had in the past. However, it see
by jcranmer 3y ago
Sounds like a cool tool.
The ability to write rewrites as regular code fragments with metavariables feels like some ideas I've had in the past. However, it seems to me that your tool lacks the ability to do something like (in C/C++/etc. terms) "replace every use of S::method($arg1) with S::method2(arg1, nullptr, $arg1)", where you have to do some amount of name resolution to know that x->method is a call to S::method, which seems like it is somewhat less useful for several kinds of rewrites I'm interested in.
(One of the main things I keep playing around with in my head is converting a C codebase into C++ by converting its ad-hoc vtable implementation into regular C++ virtual methods.)
- morgante 3y agoWe don't have semantic information yet (it's on the roadmap), but in many cases it's sufficient to get that information from the AST by looking where the variable was originally defined. For example: https://app.grit.io/studio?key=TteyWLNGZGWFIC9EOiCRi https://app.grit.io/studio?key=TteyWLNGZGWFIC9EOiCRi `$x.old($arg)` => `$x.new("method", _, $arg)` where { $program <: contains `$x = new Thing($_)` } --- Long term we want to incorporate more semantic analysis, but for quick rewrites this has been pretty effective for us.