emacs-tangents
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help building Pen.el (GPT for emacs)


From: Eli Zaretskii
Subject: Re: Help building Pen.el (GPT for emacs)
Date: Sat, 24 Jul 2021 17:37:39 +0300

> From: Philip Kaludercic <philipk@posteo.net>
> Cc: rms@gnu.org,  mullikine@gmail.com,  emacs-tangents@gnu.org,
>   stefan@marxist.se,  bugs@gnu.support
> Date: Sat, 24 Jul 2021 14:16:55 +0000
> 
> > Sorry, I don't understand what you have in mind.  Can you show an
> > example of useful code that could be copied verbatim into a program
> > without at least some renaming, without breaking the program?
> 
> To take the example from the article I mentioned above
> 
>     public static String humanReadableByteCount(long bytes, boolean si) {
>         int unit = si ? 1000 : 1024;
>         if (bytes < unit) return bytes + " B";
>         int exp = (int) (Math.log(bytes) / Math.log(unit));
>         String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : 
> "i");
>         return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
>     }
> 
> can be copied into a Java program, and assuming that there is no other
> method called humanReadableByteCount in the same class, it should
> compile and run without renaming or re-typing.

How would one know it's 'long' and not some other data type?

> CoPilot might generate this from a comment like,
> 
>     // Convert a byte count to a human-readable string
> 
> since it is mentioned over 6000 times on GitHub (and this method even
> has a bug, as the article explains -- but that is a totally different
> issue).

That's not how AI works: it doesn't just count the number of times
something is mentioned.  That usually leads to unsatisfactory results.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]