public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Damien MATTEI <Damien.Mattei@unice.fr>
To: kawa@sourceware.org
Subject: Re: variable definition in include files not usable in class file
Date: Wed, 04 Oct 2017 13:46:00 -0000	[thread overview]
Message-ID: <201710041546.41991.Damien.Mattei@unice.fr> (raw)
In-Reply-To: <a6bb12f1-3bd1-a3ab-7395-a01e4e48c4ac@bothner.com>


i find the problem, can not explain it really, but it is solved ,see below:
Le Tuesday 03 October 2017 18:12:56 Per Bothner, vous avez écrit :
> On 10/03/2017 06:41 AM, Damien MATTEI wrote:
> > hello,
> > i try to use a variable defined in an include files and i got an error,
> 
> I assume you've tried replacing the 'include-relative' by directly pasting
> (with your text editor) the contents of debug.scm?  That is useful for confirming
> whether the issue specifically has to do with include.
no but after test it does not change
> 
> Is more than one thread involved?  I.e. could debug-mode or debug-mode-save
> be accessed from more than one thread?
at this time of test only one, but as the tomcat server "threads" the requests i can not say 
that in all case, for example with multiple request at same time it can be the same thing
> 
> Because of the way debug-mode-reload is implemented, it is not possible
> to "nest" calls to your debug procedures.  I.e. you can't debug an expression
> that calls a procedure that in turns uses debug.
yes, i understant debug-mode-reload is not "re-antrant" (french) meaning re-enter? in english
but this function is not used in Kawa or Bigloo, it was written for Racket Scheme and used in another code
> 
> It would be better to make debug-mode a parameter object:
> https://www.gnu.org/software/kawa/Parameter-objects.html
> That handles nesting and multiple threads.
have read but i admit, i do not understand; requires perheaps some expert java knowledge i have not
> 
> Alternatively, you debug-mode a "fluid" variable. (Paramaters and
> fluid variable are similar except you have to ad an extra layer of parentheses to
> "call" a parameter object.)
> https://www.gnu.org/software/kawa/Eval-and-Environments.html#idm139913596422880
> 
> (define-variable debug-mode #t)
i try this (define-variable) but it compiles but crashed the apps on the deployment on the server, possible i put it in a bad place (class definition see commented code updated)
> 
> (define-syntax debug
>    (syntax-rules ()
>      
>      ((_ instruction)
>       (fluid-let ((debug-mode #t))
>          instruction))
>      ...))

so finally , it worked simply by commenting
;;(debug-mode #t) in the LET definition in the main program function (not the include file)
and still putting in the main function a  (set! debug-mode #f) or (set! debug-mode #t)

in conclusion , and this the strange thing i do not really understand, the (define debug-mode #t) in debug.scm is
usefull to avoid a not defined variable error but the value of debug-mode has no effect after in the main function of the class,
you have to set! it otherwise it is in Kawa set to #!null and in Bigloo it is set to #f !!! (even with (define debug-mode #t) in debug.scm but bigloo scheme compiler to jvm is old, only the C is up to date)

i try also to change the place of the include-relative (to try to make the definitions near the us of them):
-before the module definition it is impossible (DBtoWebObserversKawa.scm:26:1: too late to set module-name)
-in the class definition,between the class name definition and the main (work) method it then simply ignore the definitions:
DBtoWebObserversKawa.scm:283:6: warning - no declaration seen for debug-only
DBtoWebObserversKawa.scm:397:9: warning - no declaration seen for debug-display-nl
-in the main method (named work) i have a new warning:
/home/mattei/Dropbox/Jkawa/../git/LOGIKI/lib/debug.scm:77:18: static DBtoWebObserversKawa references non-static debug-mode
DBtoWebObserversKawa.scm:56:22: warning - simple class DBtoWebObserversKawa requiring lexical link (because of reference to debug-mode) - use define-class instead


it works now (i commited the version that works)
thank for your help,
Damien

     
     

      reply	other threads:[~2017-10-04 13:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03 13:41 Damien MATTEI
2017-10-03 15:21 ` Sudarshan S Chawathe
2017-10-03 15:34   ` Damien Mattei
2017-10-03 15:35     ` Damien Mattei
2017-10-03 16:13 ` Per Bothner
2017-10-04 13:46   ` Damien MATTEI [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=201710041546.41991.Damien.Mattei@unice.fr \
    --to=damien.mattei@unice.fr \
    --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).