This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: learning scheme with kawa
- From: Debabrata Pani <debabrata dot pani at gmail dot com>
- To: Per Bothner <per at bothner dot com>
- Cc: kawa at sourceware dot org
- Date: Mon, 26 Oct 2015 09:13:08 +0530
- Subject: Re: learning scheme with kawa
- Authentication-results: sourceware.org; auth=none
- References: <CAKJw4fdTWByFgD9LW9L2cXSneX9fh7tWHes=jGtYZYL=fVPw2w at mail dot gmail dot com> <562D2117 dot 4050405 at bothner dot com>
Thank you for the information, Per.
On changing the method name shorter? -> is_shorter? it works fine.
Of course your suggestion to modify the behavior makes sense as well.
Regards,
Debabrata Pani
On Mon, Oct 26, 2015 at 12:06 AM, Per Bothner <per@bothner.com> wrote:
>
>
> On 10/25/2015 10:59 AM, Debabrata Pani wrote:
>>
>> Is this a known discrepancy in the behavior of kawa?
>>
>> Are we violating any RNRS rule when we do this ?
>
>
> It's a Kawa feature that is misbehaving.
>
> As a work-around, try using require instead of load:
>
> (require âreciprocal.ssâ)
>
> This causes the whole file to be processed as a unit,
> so the definition of shorter? is visible when compiling shorter.
>
> The gory details:
>
> The "feature" is that Kawa has special handling when it
> sees TYPE? . If there is no known definitions of TYPE?,
> but there is a known definition of TYPE then it will
> convert the TYPE? to '(lambda (obj) (instance? obj TYPE))'
>
> In this case, the Kawa compiler sees shorter?, there is (yet) no
> definition of shorter?, but there is one of shorter, so it
> does the above transformation.
>
> I think this is a Kawa bug. It should only convert TYPE?
> to (lambda (obj) (instance? obj TYPE)) when TYPE is actually
> bound to a class or a type. I'll have to think about the best
> way to do this.
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/