From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.tangents Subject: Re: Help building Pen.el (GPT for emacs) Date: Sat, 24 Jul 2021 17:37:39 +0300 Message-ID: <83czr7zsjw.fsf@gnu.org> References: <83im1948mj.fsf@gnu.org> <83lf642jeh.fsf@gnu.org> <83r1fp1es9.fsf@gnu.org> <837dhg1a1l.fsf@gnu.org> <87czr89n1a.fsf@posteo.net> <83y29wywfg.fsf@gnu.org> <87a6mc12it.fsf@posteo.net> <83mtqcyn6h.fsf@gnu.org> <875ywz23vs.fsf@posteo.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16439"; mail-complaints-to="usenet@ciao.gmane.io" Cc: stefan@marxist.se, emacs-tangents@gnu.org, mullikine@gmail.com, rms@gnu.org, bugs@gnu.support To: Philip Kaludercic Original-X-From: emacs-tangents-bounces+get-emacs-tangents=m.gmane-mx.org@gnu.org Sat Jul 24 16:38:21 2021 Return-path: Envelope-to: get-emacs-tangents@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m7InF-00048D-4S for get-emacs-tangents@m.gmane-mx.org; Sat, 24 Jul 2021 16:38:21 +0200 Original-Received: from localhost ([::1]:55912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7InE-0005n5-5h for get-emacs-tangents@m.gmane-mx.org; Sat, 24 Jul 2021 10:38:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7Imv-0005mx-Pi for emacs-tangents@gnu.org; Sat, 24 Jul 2021 10:38:01 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:42184) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7Imt-0000E2-UY; Sat, 24 Jul 2021 10:37:59 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1572 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7Imm-0001X9-NY; Sat, 24 Jul 2021 10:37:53 -0400 In-Reply-To: <875ywz23vs.fsf@posteo.net> (message from Philip Kaludercic on Sat, 24 Jul 2021 14:16:55 +0000) X-BeenThere: emacs-tangents@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Emacs news and miscellaneous discussions outside the scope of other Emacs mailing lists List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-tangents-bounces+get-emacs-tangents=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-tangents" Xref: news.gmane.io gmane.emacs.tangents:689 Archived-At: > From: Philip Kaludercic > 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.