public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Damien MATTEI <damien.mattei@oca.eu>
To: phiroc@free.fr, Damien MATTEI <Damien.MATTEI@univ-cotedazur.fr>
Cc: kawa@sourceware.org, Jean-Paul Roy <Jean-Paul.Roy@unice.fr>
Subject: Re: define-syntax can only be used with local variables
Date: Thu, 16 Sep 2021 15:44:30 +0200	[thread overview]
Message-ID: <b3506765-8185-3b2a-9e53-929da451d8f5@oca.eu> (raw)
In-Reply-To: <1475543959.217980716.1631790302735.JavaMail.root@zimbra65-e11.priv.proxad.net>

you know in Scheme ,things are sometimes weird, look at this example 
where i just encountered an 'undefined x' at line 4 of foo:

#lang racket

(define (foo)
   (let ((x 7))
     (let ((x 3))
       (display x) ;; undefined x here !
       (newline)
       (define x 2)
       (display x)
       (newline))
     (display x)
     (newline)))

it was just that the define 2 lines after! create the problem

i admit it is an example build to create problems! LOL

Damien

Le 16/09/2021 à 13:05, phiroc@free.fr a écrit :
> Hi,
> I've no idea. The Kawa Developers, if they are are reading this thread, may be able to answer your question.
> Perhaps, there was no distinction between the Transformer (Macro) Environment and the Normal Environment in Kawa 2.0, contrary to Kawa 3.1.1.
> All in all, the Chinese Wall between the Transformer Environment and the Normal Environment is good because it prevents you from shooting yourself in the foot.
>
>
> ----- Mail original -----
> De: "Damien MATTEI" <damien.mattei@oca.eu>
> À: kawa@sourceware.org
> Envoyé: Jeudi 16 Septembre 2021 12:41:31
> Objet: Re: define-syntax can only be used with local variables
>
> but why is it working with one version of kawa and not another? or did i
> missed something in discussion?
>
> Damien
>
> Le 16/09/2021 à 12:02, phiroc--- via Kawa a écrit :
>
>> Hello,
>> here's an explanation :
>>
>> "The statement (set! *myglobal* "This does not") is executed in the transformer environment, not the normal environment. So it's not able to find *myglobal. We need to get both the expressions executed in the environment where *myglobal* is defined."
>>
>> cf. https://stackoverflow.com/questions/5509837/set-global-from-scheme-macro
>>
>>
>>
>> ----- Mail original -----
>> De: "phiroc--- via Kawa" <kawa@sourceware.org>
>> À: kawa@sourceware.org
>> Envoyé: Mercredi 15 Septembre 2021 09:10:15
>> Objet: Re: define-syntax can only be used with local variables
>>
>> Good morning,
>> on Windows 10, using Kawa 3.1.1 and JDK 1.8.0_191, (nil2! y) fails to set y to '(0).
>> Hence, there's probably a bug in the Kawa code (unless, in Scheme, macros are not supposed to set dynamic variables).
>> Best regards,
>> Philippe
>>
>> -----------------------------------------------
>>
>>
>>
>>
>> (define-syntax nil2!
>>       (syntax-rules ()
>>           ((_ x)
>>                (set! x '(0)))))
>>
>> (define y '(1))
>> (nil2! y)
>> (display y) (newline)
>>
>>
>>
>>
>> ----- Mail original -----
>> De: "Per Bothner" <per@bothner.com>
>> À: "Damien MATTEI" <Damien.MATTEI@univ-cotedazur.fr>
>> Cc: kawa@sourceware.org
>> Envoyé: Mardi 14 Septembre 2021 21:30:55
>> Objet: Re: define-syntax can only be used with local variables
>>
>>
>>
>> On 9/14/21 11:38 AM, Damien Mattei wrote:
>>> message of compiler is big, here is a part:
>>>
>>> (for f in kawa/standard/SchemeScriptEngineFactory.java kawa/GuiConsole.java kawa/GuiInPort.java kawa/ReplPane.java kawa/ReplDocument.java kawa/ReplPaneOutPort.java gnu/kawa/models/Box.java gnu/kawa/models/Button.java gnu/kawa/models/Column.java gnu/kawa/models/DDimension.java gnu/kawa/models/Display.java gnu/kawa/models/DrawImage.java gnu/kawa/models/DrawShape.java gnu/kawa/models/FillShape.java gnu/kawa/models/Label.java gnu/kawa/models/Model.java gnu/kawa/models/ModelListener.java gnu/kawa/models/MenuItem.java gnu/kawa/models/Picture.java gnu/kawa/models/Pictures.java gnu/kawa/models/PictureToSvg.java gnu/kawa/models/PictureVisitor.java gnu/kawa/models/PBox.java gnu/kawa/models/Row.java gnu/kawa/models/Spacer.java gnu/kawa/models/StandardColor.java gnu/kawa/models/SVGUtils.java gnu/kawa/models/Text.java gnu/kawa/models/Viewable.java gnu/kawa/models/WeakListener.java gnu/kawa/models/Window.java gnu/kawa/models/WithComposite.java gnu/kawa/models/WithPaint.java
>>> gnu/kawa/models/WithTransform.java  ; do echo ./$f; done) >>tmp-list
>>> mv tmp-list tmp-sources1.list
>>> javac -d . -classpath ".:.:$CLASSPATH" -g @tmp-sources1.list
>>> ./gnu/lists/CharSeq.java:11: error: types CharSequence and Sequence<E> are incompatible;
>>> public interface CharSeq
>>>           ^
>>>      interface CharSeq inherits abstract and default for isEmpty() from types CharSequence and Sequence
>>>      where E is a type-variable:
>>>        E extends Object declared in interface Sequence
>> I'm trying the latest (gitlab) Kawa with the JDK 17 (general release today).
>> I'm not seeing this error.  I'm seeing the warnings, most of which seem to
>> be easily fixable (by using 'Integer.valueOf' instead of 'new Integer' etc);
>> I'm working on those now.
>>

  reply	other threads:[~2021-09-16 13:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <971550055.197381511.1631259004148.JavaMail.root@zimbra65-e11.priv.proxad.net>
2021-09-10  7:33 ` phiroc
2021-09-14 12:42   ` Damien Mattei
2021-09-14 16:14     ` Philippe de Rochambeau
2021-09-14 16:34       ` Damien Mattei
2021-09-14 16:58         ` Philippe de Rochambeau
2021-09-14 17:26   ` Per Bothner
2021-09-14 17:38     ` Damien Mattei
2021-09-14 17:58     ` Damien Mattei
2021-09-14 18:00       ` Damien Mattei
2021-09-14 18:07         ` Per Bothner
2021-09-14 18:38           ` Damien Mattei
2021-09-14 19:30             ` Per Bothner
2021-09-15  7:10               ` phiroc
2021-09-16 10:02                 ` phiroc
2021-09-16 10:41                   ` Damien MATTEI
2021-09-16 11:05                     ` phiroc
2021-09-16 13:44                       ` Damien MATTEI [this message]
2021-09-17  5:29                       ` Per Bothner
2021-09-17  7:00                         ` phiroc
2021-09-17 10:48                           ` Per Bothner
2021-09-16 21:11                   ` Per Bothner

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=b3506765-8185-3b2a-9e53-929da451d8f5@oca.eu \
    --to=damien.mattei@oca.eu \
    --cc=Damien.MATTEI@univ-cotedazur.fr \
    --cc=Jean-Paul.Roy@unice.fr \
    --cc=kawa@sourceware.org \
    --cc=phiroc@free.fr \
    /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).