MacroTools.jl icon indicating copy to clipboard operation
MacroTools.jl copied to clipboard

rmlines would be more useful if it worked recursively

Open MarkNahabedian opened this issue 2 years ago • 1 comments

rmlines would be more useful it it worked recursively.

rmlines(Meta.parse("""
begin
   begin
      begin
end
end
end"""))
quote
    begin
        #= none:3 =#
        begin
            #= none:4 =#
        end
    end
end

Yes, one could use postwalk, but I don't think one should have to.

Also, why isn't postwalk exported?

At the very least, the documentation should manage expectations by saying that it doesn'[t work recursively and suggesting the use of postwalk.

MarkNahabedian avatar Dec 10 '21 17:12 MarkNahabedian

The docs seem fine to me? If you feel it can be better written, make a PR.

I can't speak for Mike, but presumably having these functions be non-recursive by default means that you could chain them inside of a single postwalk, which is more efficient than doing N postwalks, so I would keep the current design.

Also, why isn't postwalk exported?

I wouldn't mind exporting them, but... 🤷 Does anyone else have feelings either way?

cstjean avatar Dec 11 '21 00:12 cstjean