unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: Nala Ginrut <nalaginrut@gmail.com>, Guile User <guile-user@gnu.org>
Subject: Re: Screaming-Fist: a JIT framework for Guile
Date: Mon, 4 Dec 2023 22:26:37 +0100	[thread overview]
Message-ID: <f0be0d3c-780f-0491-aabd-6df60efb9f6c@telenet.be> (raw)
In-Reply-To: <CAPjoZoe=jeR-QxsQ5XSEK3p2RhyZE8rL2QRJhVy=jiL+zoT-uQ@mail.gmail.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1135 bytes --]



Op 03-12-2023 om 18:26 schreef Nala Ginrut:
> (jit-define (square x)
>    (:anno: (int) -> int)
>    (* x x))
> (square 5)


Potentially-overflowing arithmetic involving ints (not unsigned ints, 
but ints)? Best document somewhere to what the jit code '(* x x)' 
evaluates when (not (<= min-int (* x x) max-int))).

Personally, I'm in favor of explicit long names like

*/error-on-overflow     (<-- maybe on the C-level the function could 
return a tagged union representing (failure [no value]) / (success [some 
value], at a slight performance cost)
*/wrap-around
*/undefined-on-overflow (<-- like in C, for maximal performance and 
dragons).

(Likewise for +, - and unsigned int)

Sure, they are a bit verbose, but they are explicit and 
non-explicitness+undefined behaviour of'*' in C has caused serious 
issues in the past, so I'd think it's better that the programmer has to 
choose what, in their situation, are the appropriate semantics.

If/when someone desired shorter names, there could be a
(jit-define-alias * */wrap-around) or something like that for that?

Best regards,
Maxime Devos

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  parent reply	other threads:[~2023-12-04 21:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03 17:26 Screaming-Fist: a JIT framework for Guile Nala Ginrut
2023-12-03 20:49 ` Dr. Arne Babenhauserheide
2023-12-05  9:36   ` Nala Ginrut
2023-12-04 21:26 ` Maxime Devos [this message]
2023-12-05 10:14   ` Nala Ginrut
2023-12-05 20:30     ` Nala Ginrut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f0be0d3c-780f-0491-aabd-6df60efb9f6c@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=guile-user@gnu.org \
    --cc=nalaginrut@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).