|
From: | Dmitry Gutov |
Subject: | Re: Subprojects in project.el |
Date: | Mon, 28 Nov 2022 02:41:12 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 |
On 26/11/22 01:55, João Távora wrote:
In most cases we will say it's not a good idea, but when a practical goal is described we will decide to either say "go ahead, it's okay in this case", or, hopefully, suggest a different way to reach that goal (just like I did with the 'project-parent' definition example). Or rethink and throw away the whole design (hopefully not).I don't think it has to be so extreme. I don't understand why there isn't a user-callable construtor for a type of project that is currently represented by the '(transient . "<dir>") implementation detail. Demanding that the users of looking to add to project-find-functions additionally define a whole new type and all the operations to go with it is unreasonable, IMO. I don't think it's "throwing away the whole design" to provide one such constructor or a means to simplify this.
Do you actually want to use 'transient' in more places?I get why it's okay for Eglot: it only needs the root and the primitive buffer listing logic, and not anything else.
But instantiating it in a function that returns a value to be used for all (project.el related) purposes would not be wise.
Even better, provide a CLOS class, so that users may subclass it and use inheritance in the CLOS generics.
CLOS classes (or cl-struct) codify the structure, though, forcing us to make it stable.
As long as we're talking about the 'transient' type, it will likely remain as-is for all the years to come, because there's little to be gathered from one user prompt aside from the directory (and that's the main place where the 'transient' instances come from).
So I'm not sure why you'd want a CLOS hierarchy start from it: there is nothing to inherit. Just create your classes. The very top one will have to have a definition (an obvious one, 2 line long) for 'project-root', and the result will have all the behaviors of 'transient' already.
[Prev in Thread] | Current Thread | [Next in Thread] |