[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Declaring Lisp function types
From: |
Stefan Monnier |
Subject: |
Re: Declaring Lisp function types |
Date: |
Sun, 03 Mar 2024 13:13:45 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>>>> - What will/could happen if the result does not have the
>>>> specified type?
>>> I think we want to complete it with the inferred return type if we have
>>> it or t otherwise.
>> Same here: I meant what happens when `my-fun` actually returns nil
>> even though its own type declaration claims it returns a number?
> We might generate wrong code.
That's the point of view of the compiler writer. We need to state it
from the point of view of the user, i.e. describe the potential behavior
of that wrong code we might generate.
Also the description should be clear enough that a user can guess what
happens if the type annotation was correct but the function gets
redefined (e.g. via an advice) which does not obey the same type.
>> Maybe we should also give a hint about the potential benefits (how it
>> influences the generated code), so coders can have a better idea about
>> when a type annotation is worthwhile and when it's not.
> Yep, I don't know where these info should be placed in the manual.
> Maybe there should be an area dedicated to the native compiler?
I'd put it somewhere inside the "@chapter Compilation of Lisp to Native
Code" in `compile.texi`.
Stefan
- Re: Declaring Lisp function types, Andrea Corallo, 2024/03/15
- Re: Declaring Lisp function types, Tomas Hlavaty, 2024/03/15
- Re: Declaring Lisp function types, Eli Zaretskii, 2024/03/15
- Re: Declaring Lisp function types, Tomas Hlavaty, 2024/03/16
- Re: Declaring Lisp function types, Eli Zaretskii, 2024/03/16
- Re: Declaring Lisp function types, Tomas Hlavaty, 2024/03/16
- Re: Declaring Lisp function types, Eli Zaretskii, 2024/03/16
- Re: Declaring Lisp function types, Emanuel Berg, 2024/03/16
- Re: Declaring Lisp function types, Lele Gaifax, 2024/03/18
- Re: Declaring Lisp function types, Emanuel Berg, 2024/03/16