bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18604: master srfi-26 cute compile error


From: Mark H Weaver
Subject: bug#18604: master srfi-26 cute compile error
Date: Sun, 05 Oct 2014 13:12:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Daniel Llorens <address@hidden> writes:

> stable-2.0 with either cut or cute works. The compiler in master works for 
> cut but not for cute.
>
> scheme@(guile-user)> (import (srfi srfi-26))
> scheme@(guile-user)> (cute < 1 <> 2)
> While compiling expression:
> ERROR: Wrong number of arguments to #<procedure 10b5a4380 at 
> language/cps/types.scm:724:0 (in succ a b)>

The problem here is that the type analysis pass assumes that '<' takes
exactly two arguments.  In common cases, this works out okay because the
earlier 'expand-primitives' pass has rules that convert uses of '<' into
chains of binary '<' operations.  However, that only works when '<' is
in operator position at the time of the 'expand-primitives' pass.  In
the case of 'cute', this is not the case:

  scheme@(guile-user)> ,expand (cute < 1 <> 2)
  $1 = (let ((t-86 2) (t-85 1) (t-84 <))
    (lambda (t-96) (t-84 t-85 t-96 t-86)))

Then the partial evaluator does its thing:

  scheme@(guile-user)> ,optimize (cute < 1 <> 2)
  $2 = (lambda (t-113) (< 1 t-113 2))

and then the type analysis pass fails because its type-checkers and
type-inferrers for '<' (line 723 of language/cps/types.scm) assume that
it's a binary operation.

      Mark





reply via email to

[Prev in Thread] Current Thread [Next in Thread]