Extending SEdit and File Manager to new definition types

63 views
Skip to first unread message

Paolo Amoroso

unread,
Jun 1, 2023, 2:15:51 PM6/1/23
to Medley Interlisp Users/Interest
I'm writing a tiny unit test framework for Interlisp that supports defining test functions with the DEFUN-like DEFTEST macro, for example:

(DEFTEST TEST+ ()
  (CHECK.EXPECT
    (EQP (PLUS 1 2) 3)
    (EQP (PLUS 2 3) 5)))

I'd like to edit DEFTEST forms with SEdit and save them to symbolic files with the File Manager. While I'm reasonably sure I need to create a new File Manager type for the latter as explained in IRM, for example the type TESTS, I'm not sure how to do the former. Is it possible to extend SEdit to handle new definition forms like DEFTEST, in such a way that SEdit properly formats the sexps and interacts with the File Manager like other definition types such as FNS and FUNCTIONS?

Unlike the other major Medley tools and applications like TEdit, the File Manager, the Grapher, Sketch, and Notecards, SEdit seems the only one with no programmer's interface.

Nick Briggs

unread,
Jun 1, 2023, 2:59:47 PM6/1/23
to Paolo Amoroso, Medley Interlisp Users/Interest
Have you started by looking at sources/SEDIT.TEDIT ?  Also possibly of interest (I haven’t looked carefully) - docs/internal/SEdit.NOTEFILE

Re: "SEdit seems the only one with no programmer's interface” - well, it does, it’s just not a separately documented interface that we can find, but you’ve got the entire source available to study.  For sure, look at the external symbols in the SEDIT package.

See things like (DEF-LIST-FORMAT …) in SEDIT-LIST-FORMATS, and SEDIT-FORMATS.  SEDIT-INDENT is the indentation engine, and I believe has quite a bit of flexibility.

I don’t remember whether Mike wrote a tech report on SEdit, but I can ask him.


--
https://Interlisp.org for more details
---
You received this message because you are subscribed to the Google Groups "Medley Interlisp Users/Interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to interlisp+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/interlisp/CAGi1hzsMoneorzQ%2B_k--H7HeS4dxL4nD8NBdGH9FOWs43T3JLA%40mail.gmail.com.

Paolo Amoroso

unread,
Jun 1, 2023, 3:54:57 PM6/1/23
to Nick Briggs, Medley Interlisp Users/Interest
Thanks Nick, I haven't checked the sources yet as I hoped the programmer's interface was documented somewhere.

SEDIT.TEDIT is very useful because, although the first part of the document is available elsewhere such as in the Medley release notes at Bitsavers, I hadn't seen the documentation of the programmer's interface anywhere else. It didn't occur to me to look at the source tree for additional documentation files.

Paolo Amoroso

unread,
Jun 4, 2023, 6:01:06 AM6/4/23
to Medley Interlisp Users/Interest
On Thursday, June 1, 2023 at 8:15:51 PM UTC+2 Paolo Amoroso wrote:
I'm writing a tiny unit test framework for Interlisp that supports defining test functions with the DEFUN-like DEFTEST macro, for example:

I published the initial code of the test framework, Femtounit.

Larry Masinter

unread,
Jun 4, 2023, 9:27:39 AM6/4/23
to Paolo Amoroso, Medley Interlisp Users/Interest
There is an extensive test framework in the test repo

--
LarryMasinter.net

On Jun 4, 2023, at 3:01 AM, Paolo Amoroso <paolo....@gmail.com> wrote:


On Thursday, June 1, 2023 at 8:15:51 PM UTC+2 Paolo Amoroso wrote:
I'm writing a tiny unit test framework for Interlisp that supports defining test functions with the DEFUN-like DEFTEST macro, for example:

I published the initial code of the test framework, Femtounit.

--
https://Interlisp.org for more details
---
You received this message because you are subscribed to the Google Groups "Medley Interlisp Users/Interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to interlisp+...@googlegroups.com.

Paolo Amoroso

unread,
Jun 4, 2023, 11:47:22 AM6/4/23
to Larry Masinter, Medley Interlisp Users/Interest
On Sun, Jun 4, 2023 at 3:27 PM Larry Masinter <masi...@gmail.com> wrote:
There is an extensive test framework in the test repo

I should have known better :-)

Larry Masinter

unread,
Jul 23, 2023, 11:33:03 AM7/23/23
to Paolo Amoroso, Medley Interlisp Users/Interest
perhaps you could work with me on the test framework? I haven't been able to get started on it, and it's pretty clear we need one.

--

Paolo Amoroso

unread,
Jul 23, 2023, 1:07:37 PM7/23/23
to Larry Masinter, Medley Interlisp Users/Interest
On Sun, Jul 23, 2023 at 5:33 PM Larry Masinter <L...@acm.org> wrote:
perhaps you could work with me on the test framework? I haven't been able to get started on it, and it's pretty clear we need one.

Which test framework? Medley's or Femtounit?

I was actually meaning to resume working on Femtounit as I found an easy way of integrating it with the File Manager and SEdit via XCL:DEF-DEFINE-TYPE and XCL:DEFDEFINER.


Paolo

Paolo Amoroso

unread,
Aug 19, 2023, 9:25:28 AM8/19/23
to Medley Interlisp Users/Interest
On Thursday, June 1, 2023 at 8:59:47 PM UTC+2 nicholas...@gmail.com wrote:
See things like (DEF-LIST-FORMAT …) in SEDIT-LIST-FORMATS, and SEDIT-FORMATS.  SEDIT-INDENT is the indentation engine, and I believe has quite a bit of flexibility.

I created the new File Manager type TESTS for Femtounit tests and redefined DEFTEST in terms of it and now SEdit can handle DEFTEST definitions.

I'd also like to change the way SEdit formats DEFTEST definitions so they're indented like DEFUN. I tried (SEDIT:DEF-LIST-FORMAT DEFTEST DEFUN) but it does nothing. SEdit applies the right DEFTEST formatting only if I copy and modify DEFUN's list format like this:

(SEDIT:DEF-LIST-FORMAT DEFTEST :INDENT ((2)) :ARGS (:KEYWORD NIL :LAMBDA-LIST NIL) :SUBLISTS (3))

Why doesn't (SEDIT:DEF-LIST-FORMAT DEFTEST DEFUN) work?

Paolo Amoroso

unread,
Aug 19, 2023, 9:34:39 AM8/19/23
to Medley Interlisp Users/Interest
On Sat, Aug 19, 2023 at 3:25 PM Paolo Amoroso <paolo....@gmail.com> wrote:
I'd also like to change the way SEdit formats DEFTEST definitions so they're indented like DEFUN. I tried (SEDIT:DEF-LIST-FORMAT DEFTEST DEFUN) but it does nothing. SEdit applies the right DEFTEST formatting only if I copy and modify DEFUN's list format like this:

(SEDIT:DEF-LIST-FORMAT DEFTEST :INDENT ((2)) :ARGS (:KEYWORD NIL :LAMBDA-LIST NIL) :SUBLISTS (3))

Never mind, I forgot the package. This works as expected and produces the proper indentation:

(SEDIT:DEF-LIST-FORMAT DEFTEST CL:DEFUN)

Paolo Amoroso

unread,
Aug 21, 2023, 3:37:35 PM8/21/23
to Medley Interlisp Users/Interest

Paolo Amoroso

unread,
Aug 27, 2023, 7:32:38 AM8/27/23
to Medley Interlisp Users/Interest
On Sat, Aug 19, 2023 at 3:25 PM Paolo Amoroso <paolo....@gmail.com> wrote:
I created the new File Manager type TESTS for Femtounit tests and redefined DEFTEST in terms of it and now SEdit can handle DEFTEST definitions.

Creating a new type is actually not such a good idea as the tests get duplicated. The DEFTEST macro expands into a DEFINEQ function definition and the File Manager notices both, the DEFTEST form of type TESTS and the function of type FNS.

I thought of fixing the issue by assigning tests to an existing type such as FNS. First I removed TESTS with (DELDEF 'TESTS 'DEFINE-TYPES), then replaced the type argument TESTS with FNS in the XCL:DEFDEFINER form. But when I tried to edit a sample test TEST.PLUS for the PLUS function with (ED 'TEST.PLUS :DONTWAIT), SEdit quit with the error:

Warning: Couldn't find a hash-table for FNS definitions.
One will be created.
Could not find fns definition for TEST.PLUS.
Could not find fns definition for
TEST.PLUS


Any suggestions?

Paolo Amoroso

unread,
Aug 29, 2023, 12:30:17 PM8/29/23
to Medley Interlisp Users/Interest
On Sun, Aug 27, 2023 at 1:32 PM Paolo Amoroso <paolo....@gmail.com> wrote:
Creating a new type is actually not such a good idea as the tests get duplicated. The DEFTEST macro expands into a DEFINEQ function definition and the File Manager notices both, the DEFTEST form of type TESTS and the function of type FNS.

I made some progress but the issue isn't fixed yet. Ron suggested to use PUTD instead of DEFINEQ and I redefined DEFTEST like this:

DEFTEST-PUTD.png

When defining a new test with DEFTEST the File Manager doesn't notice the test and FILES? doesn't list it at all. But, as soon as the test function is called, the File Manager does notice the function and FILES? lists it as new.

Ron Kaplan

unread,
Aug 29, 2023, 3:02:18 PM8/29/23
to Paolo Amoroso, Medley Interlisp Users/Interest
Maybe you can get the finer control that you want by adding an explicit (MARKASCHANGED name ’TEST ‘DEFINED) ?

On Aug 29, 2023, at 9:30 AM, Paolo Amoroso <paolo....@gmail.com> wrote:

On Sun, Aug 27, 2023 at 1:32 PM Paolo Amoroso <paolo....@gmail.com> wrote:
Creating a new type is actually not such a good idea as the tests get duplicated. The DEFTEST macro expands into a DEFINEQ function definition and the File Manager notices both, the DEFTEST form of type TESTS and the function of type FNS.

I made some progress but the issue isn't fixed yet. Ron suggested to use PUTD instead of DEFINEQ and I redefined DEFTEST like this:

<DEFTEST-PUTD.png>

When defining a new test with DEFTEST the File Manager doesn't notice the test and FILES? doesn't list it at all. But, as soon as the test function is called, the File Manager does notice the function and FILES? lists it as new.
--
https://Interlisp.org for more details
---
You received this message because you are subscribed to the Google Groups "Medley Interlisp Users/Interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to interlisp+...@googlegroups.com.

Paolo Amoroso

unread,
Aug 29, 2023, 4:21:10 PM8/29/23
to Ron Kaplan, Medley Interlisp Users/Interest
On Tue, Aug 29, 2023 at 9:02 PM Ron Kaplan <ron.k...@post.harvard.edu> wrote:
Maybe you can get the finer control that you want by adding an explicit (MARKASCHANGED name ’TEST ‘DEFINED) ?

Doesn't that make the File Manager notice the test definition, thus contributing to the duplication of definitions?

Larry Masinter

unread,
Sep 3, 2023, 8:58:53 PM9/3/23
to Paolo Amoroso, Ron Kaplan, Medley Interlisp Users/Interest
i'm not entirely sure what you mean by "duplication".  In the Interlisp "flie package" model, Interlisp is not a 1-lisp or a 2-lisp but a N-lisp: each symbol can have definitions as multiple types.
The types can be independent, or they can have a more complex relationship. 

Sometimes the types overlap like with FNS and FUNCTIONS and these cases were, well, special cased in the code, and might not work because the abstractions evolved and the evolution was implement-first document-last if at all.

The regime of GETDEF, PUTDEF, MARKASCHANGED, ED, EDITDEF, FILECOMSLST, WHEREIS and the ideas around treating each file as a sequence of definitions and "expressions" should probably get a separate writeup.

So, with regard to duplicates, let's spend some time Monday going over this.
Agenda forthcoming

--
https://Interlisp.org for more details
---
You received this message because you are subscribed to the Google Groups "Medley Interlisp Users/Interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to interlisp+...@googlegroups.com.

Paolo Amoroso

unread,
Sep 4, 2023, 3:42:27 AM9/4/23
to Larry Masinter, Ron Kaplan, Medley Interlisp Users/Interest
On Mon, Sep 4, 2023 at 2:58 AM Larry Masinter <L...@acm.org> wrote:
i'm not entirely sure what you mean by "duplication".  In the Interlisp "flie package" model, Interlisp is not a 1-lisp or a 2-lisp but a N-lisp: each symbol can have definitions as multiple types.

By duplication I mean the File Manager notices both a DEFTEST definition associated with a type and the DEFINEQ function (or PUTD) by the same name it expands to. So, when there are new definitions or changes, FILES? asks what to do with both forms by the same name. I'll provide more details in the meeting.

Paolo Amoroso

unread,
Sep 10, 2023, 11:14:32 AM9/10/23
to Larry Masinter, Ron Kaplan, Medley Interlisp Users/Interest
On Mon, Sep 4, 2023 at 9:42 AM Paolo Amoroso <paolo....@gmail.com> wrote:
By duplication I mean the File Manager notices both a DEFTEST definition associated with a type and the DEFINEQ function (or PUTD) by the same name it expands to. So, when there are new definitions or changes, FILES? asks what to do with both forms by the same name. I'll provide more details in the meeting.

To prevent any caching issues or unwanted effects of leftover DEFINEQs I redefined DEFTEST replacing DEFINEQ with PUTD, saved the Femtounit symbolic file, and loaded the file into a fresh Medley image. In the fresh image I defined the SQUARE function and its test TEST.SQUARE as this Exec transcript shows:

5_ (DEFINEQ (SQUARE (X) (TIMES X X)))
(SQUARE)
6_ (SQUARE 3)
9
7_ (ED 'TEST.SQUARE '(TESTS :DONTWAIT))
TEST.SQUARE has no TESTS definition.
Select a definer to use for a dummy definition.
TEST.SQUARE
8_ (FILES?)
the Femtounit unit tests: TEST.SQUARE
the advice: NC.LogoutAdvice
the functions: SQUARE
...to be dumped.  want to say where the above go ? No
9_ (TEST.SQUARE)
..
T
10_ (FILES?)
the Femtounit unit tests: TEST.SQUARE
the advice: NC.LogoutAdvice
the functions: TEST.SQUARE, SQUARE
...to be dumped.  want to say where the above go ? Yes
(Femtounit unit tests)
TEST.SQUARE  File name: SQUARE
create new file SQUARE ? Yes
(advice)
NC.LogoutAdvice  Nowhere
(functions)
TEST.SQUARE  File name: SQUARE
SQUARE  File name: SQUARE
11_


As you can see, as soon as I call TEST.SQUARE the File Manager notices two Lisp objects named TEST.SQUARE, the test definition created by DEFTEST and the PUTDed lambda created by the expansion of DEFTEST. Later in the transcript I told the File Manager where to save the tests and then saved the resulting file SQUARE attached to this message. The code in the file confirms the duplication: the two TEST.SQUARE are not just different names for the same Lisp object but different objects.
SQUARE

Paolo Amoroso

unread,
Sep 13, 2023, 8:48:58 AM9/13/23
to Larry Masinter, Ron Kaplan, Medley Interlisp Users/Interest
As Nick suggested, in DEFTEST I replaced LET, which triggers the File Manager, with PROG, which isn't supposed to. But going through the same steps of the TEST.SQUARE example still duplicates the test exactly as in the previous transcript:
Looks like the File Manager is a bit overzealous.

Paolo Amoroso

unread,
Sep 13, 2023, 9:04:07 AM9/13/23
to Larry Masinter, Ron Kaplan, Medley Interlisp Users/Interest
On Wed, Sep 13, 2023 at 2:48 PM Paolo Amoroso <paolo....@gmail.com> wrote:
As Nick suggested, in DEFTEST I replaced LET, which triggers the File Manager, with PROG, which isn't supposed to. But going through the same steps of the TEST.SQUARE example still

Here is the implementation of DEFTEST with PROG:

DEFTEST-PROG.png

Nick Briggs

unread,
Sep 13, 2023, 11:31:47 AM9/13/23
to Paolo Amoroso, Larry Masinter, Ron Kaplan, Medley Interlisp Users/Interest
Try BREAKing MARKASCHANGED before you run the test function and see where it got called from - is DWIM still getting involved and calling it?  It’s not the file manager that is being overzealous - something is telling it to do what it is doing, and that’s where we need to look — either for a bug or a hint about how not to provoke it.

— Nick


--
https://Interlisp.org for more details
---
You received this message because you are subscribed to the Google Groups "Medley Interlisp Users/Interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to interlisp+...@googlegroups.com.

Larry Masinter

unread,
Sep 13, 2023, 11:39:57 AM9/13/23
to Nick Briggs, Paolo Amoroso, Ron Kaplan, Medley Interlisp Users/Interest
please can we save Inte...@googlegroups.com for (promised to be infrequent) announcements and move this discussion to a (new) GitHub issue (https://github.com/Interlisp/medley/issues).

GitHub allows fine granularity ability to watch a repo or an individual issue of interest.
We don't have another list for those who only want infrequent announcements. 
Reply all
Reply to author
Forward
0 new messages