From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Changing a cl-defstruct definition in a published package Date: Fri, 13 Jul 2018 17:07:54 -0400 Message-ID: <33b59faf-9357-706e-2239-68411096bc51@gmail.com> References: <9afc36c6-5759-6ea0-4cd4-9d6eb6b073b5@gmail.com> <87601jx6xa.fsf@gmail.com> <8806cd3a-da5f-28da-1aa6-fff611214396@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1531515998 21607 195.159.176.226 (13 Jul 2018 21:06:38 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 13 Jul 2018 21:06:38 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 13 23:06:34 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fe5Gq-0005WT-If for ged-emacs-devel@m.gmane.org; Fri, 13 Jul 2018 23:06:32 +0200 Original-Received: from localhost ([::1]:39181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fe5Ix-0003ZG-KW for ged-emacs-devel@m.gmane.org; Fri, 13 Jul 2018 17:08:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fe5IF-0003ZB-QG for emacs-devel@gnu.org; Fri, 13 Jul 2018 17:08:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fe5IC-00058x-MP for emacs-devel@gnu.org; Fri, 13 Jul 2018 17:07:59 -0400 Original-Received: from mail-qt0-x234.google.com ([2607:f8b0:400d:c0d::234]:44059) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fe5IC-00058f-HN for emacs-devel@gnu.org; Fri, 13 Jul 2018 17:07:56 -0400 Original-Received: by mail-qt0-x234.google.com with SMTP id b15-v6so28319202qtp.11 for ; Fri, 13 Jul 2018 14:07:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=mA4VYm9Wyy7kReFk4+KKN8Cpaor66ihNgu//oBVRv3M=; b=KgBved1lZnsAFps4jzDh/YEgA968TyfDFJsX2D0IkD7I8E3qoIOzrnVyld/pph1hNq DDELcgnCB/guCs8Hi4weWNtMKRnaUXiFn1YZuTeik2xWCBvZcvhi61c00rmPsNBffrpi //PKSUOoDIXDPTBfHLuxv+RC77O4463rr91RDpAnHmvI8a3AduICfa1gwZ8qILVARhiV AyIgZWU/2/jIec9TDeioyPmuNVFXz7TTxP9fwfX//LT+G4r58R27K37gWFWa0+OoMGgL teknJZRtbTHnUx6Z82UEZBsmQvJLibBUfJEcnuYDG2ZeG3NhnELi0uyWHkQzoLmgVOXm 5LxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=mA4VYm9Wyy7kReFk4+KKN8Cpaor66ihNgu//oBVRv3M=; b=qUhygsTozev7TKquUja3tewwPsUR5GwVqCcs9T3IQnJ73l2r0hfsPREEcg2V5kbsMs wAyeuIBV0wigsi/L040gqWG4tP9pn8PISlmDqKWrKRtMjlKDrbEXhvBG6QfzDbI3gDKz 1qMOYwDeUv3odbMHwLedwes4GPSL3xLIdr4+1JzbhM1MA7ob/0Na4d52jlR2v/wWEMPC Lefvxleu6yoxkXnIeyp9llv1AvMgh/rpoDaCdJv8WzM3UeU34P6wCT4Mf2LcEZheJ3Ou NvJDtI6bjhbValwp2AIggHDcC+bSjxjfDYXpInNoZ4jGLjX9m1g4NXNvo2smcgzcRnjI I+Kw== X-Gm-Message-State: AOUpUlE4LA+gcPkKRgI5u4zTZdq4ETSojEBmNh1WGBwMiHIygDz+u+VK +m+MFDyVFkJQjkv9zI92xGwuVS6K X-Google-Smtp-Source: AAOMgpfZxuhg8DK00YH+93GuZQxbpWatUt9gOfcHjk3uSADVu0E+WF5cLgkLJHIU/nMksEgEdHHWnw== X-Received: by 2002:a0c:ad3a:: with SMTP id u55-v6mr2604747qvc.132.1531516075834; Fri, 13 Jul 2018 14:07:55 -0700 (PDT) Original-Received: from [18.26.2.123] (26-2-123.dynamic.csail.mit.edu. [18.26.2.123]) by smtp.gmail.com with ESMTPSA id f64-v6sm29016172qkf.2.2018.07.13.14.07.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 14:07:55 -0700 (PDT) In-Reply-To: Content-Language: en-GB X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::234 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:227379 Archived-At: On 2018-07-13 16:40, Stefan Monnier wrote: >>> I don't know what you're trying to do, but the only way is not to change >>> the object layout, and to guarantee that the value that the user >>> packages are looking for is indeed found there at the right time. A >>> potentially horrible amount of hookage awaits you, but you could at >>> least also add your new feature/change and get rid of the hacks later. >> >> :(. I'm going to wait for a bit and hope that someone thinks of >> a clever workaround :) Is there a way to tell package.el to recompile >> another package, maybe? > > I don't think I could come up with a clever workaround without knowing > the details (because the clever workaround will almost invariably > take advantage of some aspect of those details). I'm happy to provide more details, then. The currently problematic implementation is at https://github.com/flycheck/flycheck/pull/1400 Flycheck currently stores its error list as a list of error structs: (cl-defstruct (flycheck-error (:constructor flycheck-error-new) (:constructor flycheck-error-new-at (line column &optional level message &key checker id group (filename (buffer-file-name)) (buffer (current-buffer))))) buffer checker filename line column message level id group) We're hoping to change it to this: … buffer checker filename -coordinates -region message level id group) `-coordinates' is another struct with 4 fields (line-start, column-start, line-end, and column-end). `-region' is a cons cell of two buffer positions. The idea is that checker can supply either line/column coordinates or directly a region. These two are prefixed with `-' because they are wrapped by accessors, to support either representation and lazily convert between them: if code needs a region it uses the wrapper for -region, which ensures that that field is populated, and conversely when code (e.g. the error list) needs a line number, it gets it through a wrapper that guarantees that the number has been computed. Most Flycheck checkers are defined using a standardized macro and do not have to worry about creating or accessing individual error structures, so that code is fine. More complex error checkers, on the other hand, do create error objects directly (concrete examples include merlin, or any of the checkers that maintain a persistent background process). Let me know if there's any extra info I can provide. Cheers, Clément.