Main icon indicating copy to clipboard operation
Main copied to clipboard

Centification of tail

Open yossigil opened this issue 9 years ago • 4 comments

Consider the case of a function

  private static String runScript(final String pathname) throws IOException {
    final ProcessBuilder builder = new ProcessBuilder("/bin/bash");
    builder.command(script, pathname);
    builder.redirectErrorStream(true);
    final Process process = builder.start();
    final InputStream stdout = process.getInputStream();
    final BufferedReader reader = new BufferedReader(new InputStreamReader(stdout));
    String line;
    for (final StringBuffer $ = new StringBuffer();; $.append(line))
      if ((line = reader.readLine()) == null)
        return $ + "";
  }

looking at it tail, we see that it appropriate for centification. The name line doesn't really matter, so we want a centification tipper to convert it into

   private static String runScript(final String pathname) throws IOException {
    final ProcessBuilder builder = new ProcessBuilder("/bin/bash");
    builder.command(script, pathname);
    builder.redirectErrorStream(true);
    final Process process = builder.start();
    final InputStream stdout = process.getInputStream();
    final BufferedReader reader = new BufferedReader(new InputStreamReader(stdout));
    String ¢;
    for (final StringBuffer $ = new StringBuffer();; $.append(¢))
      if ((¢ = reader.readLine()) == null)
        return $ + "";
  }

Of course a #255 can do more now...

yossigil avatar Sep 27 '16 02:09 yossigil

@dormaayan

yossigil avatar Sep 28 '16 22:09 yossigil

Can you work on this?

yossigil avatar May 20 '17 17:05 yossigil

@yossigil , Sure I'll do that !

dormaayan avatar May 20 '17 17:05 dormaayan

And, if you are at it, you will probably need to fix certification bugs when a cent is defined at a more global context.

yossigil avatar May 20 '17 19:05 yossigil