From: Per Bothner <per@bothner.com>
To: kawa@sourceware.org
Subject: Re: no class-of ?
Date: Mon, 25 Sep 2017 17:19:00 -0000 [thread overview]
Message-ID: <4094d314-0200-30f6-c1bf-16589f9a5081@bothner.com> (raw)
In-Reply-To: <7DB8779E-1D1D-4B80-8D4D-DA50375A1B02@theptrgroup.com>
On 09/25/2017 09:58 AM, Jamison Hope wrote:
> My validate-apply handler now looks like:
>
> (define-validate validateEnsureBoolean (exp required proc)
> ((exp:isSimple 1 1)
> (let* ((e0 (visit-exp (exp:getArg 0)))
> (t0 (e0:getType)))
> (cond ((eq? t0 boolean) e0)
> ((eq? t0 int) (apply-exp = e0 0))
> ((eq? t0 void) (begin-exp e0 #t))
> (else (gnu.expr.ErrorExp
> (format #f "unsupported expression type: ~a" t0)
> (get-compilation)))))))
Of course using eq? to compare type objects is going to be very fragile.
You might consider using (for example):
(> (invoke int 'isCompatibleWithValue t0) 0)
--
--Per Bothner
per@bothner.com http://per.bothner.com/
prev parent reply other threads:[~2017-09-25 17:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-21 11:11 Sonny To
2017-09-21 15:24 ` Per Bothner
2017-09-22 18:29 ` Jamison Hope
2017-09-22 19:23 ` Per Bothner
2017-09-22 22:18 ` Jamison Hope
2017-09-22 22:26 ` Per Bothner
2017-09-23 14:31 ` Jamison Hope
2017-09-24 21:52 ` Per Bothner
2017-09-25 16:58 ` Jamison Hope
2017-09-25 17:19 ` Per Bothner [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4094d314-0200-30f6-c1bf-16589f9a5081@bothner.com \
--to=per@bothner.com \
--cc=kawa@sourceware.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).