From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by sourceware.org (Postfix) with ESMTPS id D35053858D20 for ; Mon, 28 Feb 2022 23:10:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D35053858D20 Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-2d07ae0b1bfso126135227b3.6 for ; Mon, 28 Feb 2022 15:10:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=bCp9FN4GG/QqOoK/rGAReFgMj7mQ906TAbxkfnE8YrI=; b=U5zPu5dttm4YPmjp5dhyOws/BGey94McWDnPkv7ru/yd1w3I9PvnG2JMLh3Vro1UHr UVov84GQtNunpqATDeUDTZuwJIe0OR3oBopr4NjmwubHUc1o9j1imoC7u+eWkIwqSi8z ScOZh3pLI7VkavtwI9weU50AWZYxHDOaAPpRUfMfu0bPCXvAN78FBsnixIxWMs/jTF92 ab+RxwLryevAuwoGus1139pzlvX2k0wKD7wf1CNVP/TS9Z5RUMIz7ZM91rbRjA4lpTn4 2udPiNygWxFYphMrJ0vPq0Mch7ufMhjTZCM1phugiBglY3MwNBZz152XrIla+5a7u9FZ UVsw== X-Gm-Message-State: AOAM533G/f0/zggBITNZsvgKlfpzbo803cpCA5AplTZRUbikMrcWf92H b/58AW2eWOZOWFTRJrGewGr1/HVsCsiXBv860zs72o4oQj0= X-Google-Smtp-Source: ABdhPJzl5eXd1yO4kEyvDkXnvdFcRl6NLCxP6WWuUJ0iZuRCA2rufcUuTu+ySLQ50cSWguYzZe/vrSkbidHrdJv7NuU= X-Received: by 2002:a81:a884:0:b0:2d0:e230:8daf with SMTP id f126-20020a81a884000000b002d0e2308dafmr22400315ywh.391.1646089851071; Mon, 28 Feb 2022 15:10:51 -0800 (PST) MIME-Version: 1.0 From: Panicz Maciej Godek Date: Tue, 1 Mar 2022 00:10:34 +0100 Message-ID: Subject: java.lang.RuntimeException: invoke: no method named `$000a' in class gnu.expr.PrimProcedure To: kawa@sourceware.org X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: kawa@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Kawa mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Feb 2022 23:10:53 -0000 I have a new problem. When I invoke a function, I get the following error: java.lang.RuntimeException: invoke: no method named `$000a' in class gnu.expr.PrimProcedure The definition of the function is a bit complex, but I'll paste it here anyway: (define (cursor-under left::real top::real elems #!key (screen::Screen (current-screen)) (context::Cursor '())) ::Cursor (let ((box (extent elems screen)) (max-width 0) (max-line-height (screen:min-line-height)) (side 0) (ceiling 0) (index (first-index elems))) (define (check-spaces! spaces::string)::Cursor (WARN "check-spaces! (" spaces")") (call/cc (lambda (return) (for i from 0 below (length spaces) (WARN i) (cond ((eq? (spaces i) #\newline) (set! ceiling (+ ceiling max-line-height)) (when (is top < ceiling) (return (recons* i index context))) (set! side 0) (set! max-line-height (screen:min-line-height))) (else (set! side (+ side 1)) (when (and (is side < left <= (+ side 1)) (is top <= max-line-height)) (return (recons* i index context))) (set! max-width (max max-width side))))) (set! index (next-index index elems)) #!null))) (define (advance! extent::Extent)::Null (WARN "advance!" extent) (set! side (+ side extent:width)) (set! max-line-height (max extent:height max-line-height)) (set! max-width (max side max-width)) (set! index (next-index index elems)) #!null) (define (check! part extent::Extent)::Cursor (WARN "check!" part extent) (if (and (is side <= left <= (+ side extent:width)) (is ceiling <= top <= (+ ceiling extent:height))) (let ((cursor (recons index context))) (or (and (pair? part) (cursor-under (- left side) (- top ceiling) part screen: screen context: cursor)) cursor)) (advance! extent))) (define (check-separating-bar! pair)::Cursor (WARN "check-separating-bar!" pair) (cond ((should-the-bar-be-horizontal? pair) (let ((bar-height (screen:horizontal-bar-height))) (if (is ceiling <= top <= (+ ceiling bar-height)) (recons index context) (advance! (Extent width: 0 height: bar-height))))) (else (let ((bar-width (screen:vertical-bar-width))) (if (is side <= left (+ side bar-width)) (recons index context) (advance! (Extent width: bar-width height: 0))))))) (define (check-next! pair)::Cursor (WARN "check-next!" pair) (or (check! (head pair) (head-extent pair screen)) (check-spaces! (post-head-space pair)) (and (dotted? pair) (or (check-separating-bar! pair) (check-spaces! (pre-tail-space pair)) (check! (tail pair) (tail-extent pair screen)) (check-spaces! (post-tail-space pair)))) (and (pair? pair) (check-next! pair)))) (or (and (is 0 <= left < (screen:paren-width)) (is 0 <= top < box:height) (recons index context)) (check-spaces! (pre-head-space elems)) (check-next! elems) (and (is (- box:width (screen:paren-width)) <= left <= box:width) (is 0 <= top < box:height) (recons index context)) #!null))) According to my diagnostic messages, the exception comes from the "check-spaces!" subroutine: I only see the first message printed, and the remaining ones aren't there. "for" is a macro defined in the following way: https://github.com/panicz/grasp-android/blob/master/stages/retreat/GRASP/src/for.scm The above usage should correspond to the last syntax-rule ((_ var from start below end actions ...) (let loop ((var start)) (if (< var end) (begin actions ... (loop (+ var 1)))))) and it hasn't been problematic (it works fine on small test cases in the REPL). I've noticed a few things that eplacing (length spaces) with (string-length spaces) somewhat fixes the problem (the value of spaces in the context of the bug is "\n"), but there appears to be another problem: the for-loop never terminates and the value of i is always 0. I suppose there could be some bug in the treatment of continuations when call/cc appears in the body of a method (but it's only a hypothesis). Anyway, I wonder if Kawa provides a way of performing an early return from a method (other than call/cc)?