Debug feature bracket match error?

Started by iNPRwANG, February 28, 2012, 04:31:34 PM

Previous topic - Next topic

iNPRwANG

While run this code:



(define (hello-world a)
(letn ((tmp 10)
      (val1 (* tmp 2))
  (val2 (* tmp 2)))
)
)

(debug (hello-world 10))




(define (hello-world a)

  #(letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2))))#)





[-> 3 ] s|tep n|ext c|ont q|uit > s



-----



(define (hello-world a)

  (letn ((tmp 10) (val1 #(* tmp 2)#) (val2 (* tmp 2)))))





[-> 4 ] s|tep n|ext c|ont q|uit > s



-----



(define (hello-world a)

  (letn ((tmp 10) (val1 #(* tmp 2)#) (val2 (* tmp 2)))))





RESULT: 20



[<- 4 ] s|tep n|ext c|ont q|uit > s



-----



(define (hello-world a)

  (letn ((tmp 10) (val1 #(* tmp 2)#) (val2 (* tmp 2)))))





; This cause the bracket match error.



Is it should be]






[-> 4 ] s|tep n|ext c|ont q|uit > s



-----



(define (hello-world a)

  (letn ((tmp 10) (val1 #(* tmp 2)#) (val2 (* tmp 2)))))





RESULT: 20



[<- 4 ] s|tep n|ext c|ont q|uit > s



-----



(define (hello-world a)

  #(letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2))))#)





RESULT: nil



[<- 3 ] s|tep n|ext c|ont q|uit >

cormullion

#1
Looks OK here:


newLISP v.10.3.2 on OSX IPv4/6 UTF-8, execute 'newlisp -h' for more info.
>
(define (hello-world a)
   (letn ((tmp 10)
          (val1 (* tmp 2))
         (val2 (* tmp 2)))      
      )
   )
(lambda (a)
 (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
> (debug (hello-world 10))
-----
(define (hello-world a)
  (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
[-> 3 ] s|tep n|ext c|ont q|uit > s
-----
(define (hello-world a)
  (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
[-> 4 ] s|tep n|ext c|ont q|uit > s
-----
(define (hello-world a)
  (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
RESULT: 20
[<- 4 ] s|tep n|ext c|ont q|uit > s
-----
(define (hello-world a)
  (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
[-> 4 ] s|tep n|ext c|ont q|uit > s
-----
(define (hello-world a)
  (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
RESULT: 20
[<- 4 ] s|tep n|ext c|ont q|uit > s
-----
(define (hello-world a)
  (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
RESULT: nil
[<- 3 ] s|tep n|ext c|ont q|uit > s
nil
>

Lutz

#2
From the manual description of the 'trace' function:


QuoteIf an expression occurs more than once in a function, the first occurrence of the executing function will always be highlighted (bracketed).


This only affects the highlighting, the debugger will always execute expressions in correct order. For internal reasons this cannot be avoided, or would need an unreasonable amount of code to work around it.





Ps: not sure, why the hashmark brackets don't show up on Cormullion's example. Perhaps he uses 'trace-highlight' '?

cormullion

#3
Yes, sorry, I got the wrong end of the stick on this. Was going to delete the post but errors are instructive... :)

iNPRwANG

#4
Quote from: "Lutz"From the manual description of the 'trace' function:


QuoteIf an expression occurs more than once in a function, the first occurrence of the executing function will always be highlighted (bracketed).


This only affects the highlighting, the debugger will always execute expressions in correct order. For internal reasons this cannot be avoided, or would need an unreasonable amount of code to work around it.





Ps: not sure, why the hashmark brackets don't show up on Cormullion's example. Perhaps he uses 'trace-highlight' '?


I understand. Thanks. :)