From: <tomas@tuxteam.de>
To: guile-user@gnu.org
Subject: Re: Using '-1' in a method named '*'
Date: Tue, 28 Feb 2017 09:00:30 +0100 [thread overview]
Message-ID: <20170228080030.GA10067@tuxteam.de> (raw)
In-Reply-To: <8760jvsan4.fsf@pobox.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Mon, Feb 27, 2017 at 08:21:03PM +0100, Andy Wingo wrote:
> Hi,
>
> On Mon 27 Feb 2017 11:06, Alejandro Sanchez <hiphish@openmailbox.org> writes:
>
> > (define v (make <vector3> #:x 1))
> >
> > (* -1 v) ; Does not work
> > (* -2 v) ; Works fine
>
> I believe that Guile is doing strength reduction, transforming (* -1 v)
> to (- 0 v).
Woah. This is somehow... exquisite.
> It could be that this is totally the wrong thing. Is (* x 2) -> (+ x x)
> a valid transformation if you don't know the type of x? I don't know.
What we really want to know is the meaning of '*' and '+' (is that akin
to constant folding?), but yes, for that we need some info about the type
of x, I guess.
> I think there's currently an assumption that if you extend *, that you
> will do so in a mathy way, and that you implement - + and similar. But
> in this case it's not the clear right thing to do.
>
> WDYT? We could remove this transformation, or only apply it when type
> inference has run.
If overloading is allowed then yes, it seems type inference has to go
in first?
regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAli1Lh4ACgkQBcgs9XrR2kYpEwCdGS4EaOgUy/tBL46i2Isiz1MZ
sNwAnj+JM+oX7RM6LTjC8+h6r0qnIiBO
=Cc5b
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2017-02-28 8:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-27 10:06 Using '-1' in a method named '*' Alejandro Sanchez
2017-02-27 19:21 ` Andy Wingo
2017-02-27 22:26 ` Alejandro Sanchez
2017-02-28 8:00 ` tomas [this message]
2017-02-28 8:54 ` Andy Wingo
2017-02-28 9:19 ` Andy Wingo
2017-02-28 14:24 ` Alejandro Sanchez
2017-02-28 17:53 ` Amirouche
2017-02-28 18:32 ` Ralf Mattes
2017-03-01 17:25 ` Andy Wingo
2017-03-01 23:46 ` Alejandro Sanchez
2017-03-02 0:18 ` Thomas Morley
-- strict thread matches above, loose matches on Subject: below --
2017-03-03 0:07 Sandic, Aleksandar
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=20170228080030.GA10067@tuxteam.de \
--to=tomas@tuxteam.de \
--cc=guile-user@gnu.org \
/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).