Re: let binding with c

Damien MATTEI <[email protected]>
Newsgroups gmane.lisp.scheme.bigloo
Message-ID <[email protected]>
hello,

i'm using bigloo4.2c and have had a similar issue last year,i'm using bigloo with the java option enabled to generate JVM byte code and i noticed that 
when creating string variables with nested define in function ,the code :

(define (ResultatMesuresFbeta bstr_identificateur bstr_objet)
  
  (display-var-nl "BiglooCode.scm :: ResultatMesuresFbeta :: bstr_identificateur = " bstr_identificateur)
  (display-var-nl "BiglooCode.scm :: ResultatMesuresFbeta :: bstr_objet = " bstr_objet)
    
  (define len_bstr_identificateur (byte*-length bstr_identificateur))
  (display-var-nl "BiglooCode.scm :: ResultatMesuresFbeta :: len_identificateur = " len_bstr_identificateur)
  (display-var-nl "BiglooCode.scm :: ResultatMesuresFbeta :: (string? bstr_identificateur) = " (string? bstr_identificateur))

  (define identificateur (make-string len_bstr_identificateur))
  ;;(define objet "")

  (set! identificateur  bstr_identificateur)
  ;;(set! identificateur  (string-append bstr_identificateur))

  ;;(display-var-nl "BiglooCode.scm :: ResultatMesuresFbeta :: (string-append \"\" bstr_identificateur) = "  (string-append "" bstr_identificateur))
  ;;(set! objet bstr_objet)

i had to set! the variable ,hoping it will works, finally i replaced all the nested define in function by a let* and it was ok

the code is compiled to generate byte-code running in a tomcat8 server so i did not post in bigloo list at the time it happened. 

Regards,
Damien
Le Wednesday 19 October 2016 09:33:30 Bruant, Michel, vous avez écrit :
> Hi Bigloo team,
> 
> We observe an issue with the latest bigloo-4.3  (it was already present in the previous  beta)
> I have a procedure which has a let* . In this let*, a variable is binded to a C function, something like:
> (data        (pragma::bstring "string_to_bstring_len( $1, $2 )" [....])
> Then this variable is used in some of the next bindings, and also in the body of the let*.
> But at one stage, (in the body if I remember) ; its content is wrong, corrupted.
> 
> As a workaround, we needed to change this implementation:
> - create a global variable (define data "") ; split the let* into 2 let* and add  a  (set! ...) in between to replace the previous binding.
> ... something a little bit dirty.
> I 'm not sure I can create a small test case to observe this issue; but maybe this description is enough ?
> Anyway, If you can find a fix  so that  we can remove our workaround, it will be really appreciated.
> Thanks, regards,
> Michel.
> 
> 
> 



-- 
[email protected], [email protected], UNS / OCA / CNRS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.