unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* User-defined record types, v3
@ 2017-03-29  7:14 Lars Brinkhoff
  2017-04-03 17:49 ` Lars Brinkhoff
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Brinkhoff @ 2017-03-29  7:14 UTC (permalink / raw)
  To: emacs-devel

Third review round for user-defined record types, available from the
branch scratch/record.

- ChangeLog commit messages.
- EIEIO has been adapted to use records.
- Tests have been added.
- Documentation has been updated.
- No testsuite regressions.

From the manual:

      The purpose of records is to allow programmers to create objects
    with new types that are not built into Emacs.  They are used as the
    underlying representation of @code{cl-defstruct} and @code{defclass}
    instances.
      
      Internally, a record object is much like a vector; its slots can
    be accessed using @code{aref}.  However, the first slot is used to
    hold its type as returned by @code{type-of}.  Like arrays, records
    use zero-origin indexing: the first slot has index 0.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: User-defined record types, v3
  2017-03-29  7:14 User-defined record types, v3 Lars Brinkhoff
@ 2017-04-03 17:49 ` Lars Brinkhoff
  2017-04-04  0:43   ` John Wiegley
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Brinkhoff @ 2017-04-03 17:49 UTC (permalink / raw)
  To: emacs-devel

Lars Brinkhoff wrote:
> Third review round for user-defined record types, available from the
> branch scratch/record.

John Wiegley has okayed this, so I'm planning to merge this within 24
hours.

A full boostrap build (and testsuite run) works fine.  Incremental
builds can run into problems with .elc files.  To be on the safe side, I
usually rebuild from a clean repository, but just removing all .elc
files also seems to work.



> From the manual:
>
>       The purpose of records is to allow programmers to create objects
>     with new types that are not built into Emacs.  They are used as the
>     underlying representation of @code{cl-defstruct} and @code{defclass}
>     instances.
>       
>       Internally, a record object is much like a vector; its slots can
>     be accessed using @code{aref}.  However, the first slot is used to
>     hold its type as returned by @code{type-of}.  Like arrays, records
>     use zero-origin indexing: the first slot has index 0.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: User-defined record types, v3
  2017-04-03 17:49 ` Lars Brinkhoff
@ 2017-04-04  0:43   ` John Wiegley
  2017-04-04  7:40     ` Lars Brinkhoff
  0 siblings, 1 reply; 7+ messages in thread
From: John Wiegley @ 2017-04-04  0:43 UTC (permalink / raw)
  To: Lars Brinkhoff; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

>>>>> "LB" == Lars Brinkhoff <lars@nocrew.org> writes:

LB> John Wiegley has okayed this, so I'm planning to merge this within 24
LB> hours.

So it's on the official record, I'll confirm for the list that I did OK
this. :)

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: User-defined record types, v3
  2017-04-04  0:43   ` John Wiegley
@ 2017-04-04  7:40     ` Lars Brinkhoff
  2017-04-04 12:08       ` Clément Pit-Claudel
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Brinkhoff @ 2017-04-04  7:40 UTC (permalink / raw)
  To: emacs-devel

John Wiegley wrote:
> LB> John Wiegley has okayed this, so I'm planning to merge this within
> LB> 24 hours.
> So it's on the official record, I'll confirm for the list that I did OK
> this. :)

It has been pushed.

I'll reiterate:

> A full boostrap build (and testsuite run) works fine.  Incremental
> builds can run into problems with .elc files.  To be on the safe side,
> I usually rebuild from a clean repository, but just removing all .elc
> files also seems to work.

Also, if some .elc file (outside the repository) compiled with the old
cl-defstruct breaks, there a backward compatibility mode that can be
enabled:

    (cl-old-struct-compat-mode 1)

If there's a need to go beoynd that, I have a patch to bump the version
of generated .elc files (the number after ;ELC), and enable backward
compatibility as soon as an old file is loaded.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: User-defined record types, v3
  2017-04-04  7:40     ` Lars Brinkhoff
@ 2017-04-04 12:08       ` Clément Pit-Claudel
  2017-04-04 12:32         ` Lars Brinkhoff
  0 siblings, 1 reply; 7+ messages in thread
From: Clément Pit-Claudel @ 2017-04-04 12:08 UTC (permalink / raw)
  To: emacs-devel

On 2017-04-04 03:40, Lars Brinkhoff wrote:
> John Wiegley wrote:
>> LB> John Wiegley has okayed this, so I'm planning to merge this within
>> LB> 24 hours.
>> So it's on the official record, I'll confirm for the list that I did OK
>> this. :)
> 
> It has been pushed.
> 
> I'll reiterate:
> 
>> A full boostrap build (and testsuite run) works fine.  Incremental
>> builds can run into problems with .elc files.  To be on the safe side,
>> I usually rebuild from a clean repository, but just removing all .elc
>> files also seems to work.
> 
> Also, if some .elc file (outside the repository) compiled with the old
> cl-defstruct breaks, there a backward compatibility mode that can be
> enabled:
> 
>     (cl-old-struct-compat-mode 1)
> 
> If there's a need to go beoynd that, I have a patch to bump the version
> of generated .elc files (the number after ;ELC), and enable backward
> compatibility as soon as an old file is loaded.

Is there a way for Lisp programs to read the version tag of an ELC file before loading it?

Clément.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: User-defined record types, v3
  2017-04-04 12:08       ` Clément Pit-Claudel
@ 2017-04-04 12:32         ` Lars Brinkhoff
  2017-04-04 12:48           ` Checking the version of Emacs that an ELisp file was compiled with [WAS: Re: User-defined record types, v3] Clément Pit-Claudel
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Brinkhoff @ 2017-04-04 12:32 UTC (permalink / raw)
  To: emacs-devel

Clément Pit-Claudel wrote:
> Is there a way for Lisp programs to read the version tag of an ELC
> file before loading it?

I haven't looked to see if there's a ready-made function for this.  The
code in src/lread.c just looks at the fourth byte of the first line.
Then it checks that a certain regexp is present near the beginning of
the file.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Checking the version of Emacs that an ELisp file was compiled with [WAS: Re: User-defined record types, v3]
  2017-04-04 12:32         ` Lars Brinkhoff
@ 2017-04-04 12:48           ` Clément Pit-Claudel
  0 siblings, 0 replies; 7+ messages in thread
From: Clément Pit-Claudel @ 2017-04-04 12:48 UTC (permalink / raw)
  To: emacs-devel

On 2017-04-04 08:32, Lars Brinkhoff wrote:
> I haven't looked to see if there's a ready-made function for this.  The
> code in src/lread.c just looks at the fourth byte of the first line.
> Then it checks that a certain regexp is present near the beginning of
> the file.

Thanks! I can't find such a function on the ELisp side, indeed.  Maybe it would be nice to have one.
My current strategy is to have a "canary": an ELisp file that just records the Emacs version that compiled it (using eval-when-compile).  Loading that file then allows me to read that version and decides whether I need to recompile the other files.  It'd be nicer to be able to do away with that.

Clément.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-04-04 12:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-29  7:14 User-defined record types, v3 Lars Brinkhoff
2017-04-03 17:49 ` Lars Brinkhoff
2017-04-04  0:43   ` John Wiegley
2017-04-04  7:40     ` Lars Brinkhoff
2017-04-04 12:08       ` Clément Pit-Claudel
2017-04-04 12:32         ` Lars Brinkhoff
2017-04-04 12:48           ` Checking the version of Emacs that an ELisp file was compiled with [WAS: Re: User-defined record types, v3] Clément Pit-Claudel

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).