From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:50491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hABOB-0006Ie-Hz for guix-patches@gnu.org; Sat, 30 Mar 2019 06:39:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hABOA-00040b-KK for guix-patches@gnu.org; Sat, 30 Mar 2019 06:39:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50954) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hABOA-0003zy-FB for guix-patches@gnu.org; Sat, 30 Mar 2019 06:39:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hABOA-0003ZE-66 for guix-patches@gnu.org; Sat, 30 Mar 2019 06:39:02 -0400 Subject: [bug#34948] [PATCH 1/3] records: Allow thunked fields to refer to 'this-record'. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190322172120.10974-1-ludo@gnu.org> <20190322172719.11199-1-ludo@gnu.org> <87y35660fw.fsf@elephly.net> <87a7hlzidl.fsf@gnu.org> Date: Sat, 30 Mar 2019 11:37:48 +0100 In-Reply-To: <87a7hlzidl.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sat, 23 Mar 2019 17:05:10 +0100") Message-ID: <877ecg641v.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ricardo Wurmus Cc: 34948@debbugs.gnu.org Hello! I=E2=80=99ve extended this a bit with these commits: d8bead6c5d system: Define 'this-operating-system'. adb6462c4c packages: Define 'this-package' and 'this-origin'. d2be7e3c4b records: Support custom 'this' identifiers. Now you can refer to =E2=80=98this-package=E2=80=99 and it will refer to th= e closest package in scope. The good thing is that you can refer to =E2=80=98this-package=E2=80=99 from within, say, an field, and it = will DTRT. That also means you could have things such as: (define-record-type* ;; =E2=80=A6 (file-name origin-file-name (thunked) (default (string-append (package-name this-package) "-source")))) =E2=80=A6 which is pretty fun when you think about it, since it allows you = to implicitly refer to the lexically surrounding package. That reminds me of Scala=E2=80=99s =E2=80=9Cimplicit parameters=E2=80=9D: https://docs.scala-lang.org/tour/implicit-parameters.html Ludo=E2=80=99.