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: Philip Kaludercic
Subject: Re: Help building Pen.el (GPT for emacs)
Date: Sat, 24 Jul 2021 14:16:55 +0000

Eli Zaretskii <eliz@gnu.org> writes:

>> > A sort function must state at least the data type before it can be
>> > compiled.  And if you are talking about pseudo-code that is data-type
>> > agnostic, then that's an algorithm, and is not copyrightable, AFAIK.
>> 
>> No, I was thinking about concrete code, that depending on the language
>> might even just rely on the standard library, especially if the language
>> has generics. Seeing how often SO code has been found in random
>> repositories[0], I don't think it is improbable that the trained models
>> might notice these patterns.
>
> 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. 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).

-- 
        Philip Kaludercic



reply via email to

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