<div dir="ltr">Sorry for the delay in getting back to you.<div><br></div><div>I think that what you're seeing here is just the imprecision in stack traces that has to do with how Racket's optimizer works and how the low-level stack (here by "low-level" I mean the approximate ones that are coming from a low-level of the implementation as contrasted with the ones that come when the "Debugging" radio button is selected in the language dialog) traces work.</div>
<div><br></div><div style>I can't explain why you see the source location some times and not other times (I attribute that to the imprecision in the low-level stack traces) but the reason you see something has to do with how DrRacket choses show a stack location. It does this by looking at the exception. If it is a syntax error, the location comes with the exception in a nice way and that gets used (technically, it uses exn:srclocs? and associated machinery for this). If not, then it looks for a stack that comes from the errortrace library (this is what gets lost when you turn off debugging); if that stack is present, it takes the first element of it. That's how you get precise errors, ie in this program:</div>
<div style><br></div><div style>#lang racket</div><div style>(define (f x) (+ 1 (car x)))</div><div style>(f 11)<br></div><div style><br></div><div style>you'll see highlighting around the car expression directly.</div>
<div style><br></div><div style>If that's not there, the it uses the built-in stacks, again taking the first one. This would get (probably) get you the function 'f' in the above example and, I think, would always get it, if you defeat optimizations by using this program:</div>
<div style><br></div><div style><div>#lang racket</div><div>(define (f x) (+ 1 (car x)))</div><div style>(unless (zero? (random 1)) (set! f 12))</div><div>(f 11)<br></div><div><br></div></div><div style>If none of those are around, you get no source location printed out.</div>
<div style><br></div><div style>Oh, and if the source location that you get from the above is the definitions window, then it does not print out the name of the file; it just puts the stop icon.</div><div style><br></div>
<div style>... I think that's all the relevant cases, but if you want, most of the code is in error-display-handler/stacktrace in collects/drracket/private/debug.rkt.</div><div style><br></div><div style>hth,</div><div style>
Robby</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jan 29, 2013 at 8:21 PM, Pierpaolo Bernardi <span dir="ltr"><<a href="mailto:olopierpa@gmail.com" target="_blank">olopierpa@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">AHA! You got it!<br>
<br>
It happens in the tabs which have 'No debugging...' checked, and<br>
doesn't happen otherwise.<br>
<br>
<br>
2013/1/30, Robby Findler <<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>>:<br>
<div class="HOEnZb"><div class="h5">> What is the "custom" part of the language settings you have on?<br>
><br>
> Robby<br>
><br>
><br>
> On Tue, Jan 29, 2013 at 7:47 PM, Pierpaolo Bernardi<br>
> <<a href="mailto:olopierpa@gmail.com">olopierpa@gmail.com</a>>wrote:<br>
><br>
>> Update 2: it does not depend on buffer content.<br>
>><br>
>> I have 9 tab open in this DrRacket. In 5 of them happen the strange<br>
>> message, in 4 of them it doesn't happen.<br>
>><br>
>> I tried closing one in which it happened and then reopening the same<br>
>> file in a new tab, and in the new tab it doesn't happen.<br>
>><br>
>><br>
>> 2013/1/30, Robby Findler <<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>>:<br>
>> > I don't see that with this program:<br>
>> ><br>
>> > #lang racket<br>
>> ><br>
>> > (define (integer->roman n)<br>
>> > (cond ((not (integer? n))<br>
>> > (raise-argument-error 'integer->roman "integer?" n))<br>
>> > ((positive? n)<br>
>> > (apply string-append n))<br>
>> > ((negative? n)<br>
>> > (apply string-append "NEGATIVVS " 1))<br>
>> > (else<br>
>> > "NVLLA")))<br>
>> ><br>
>> > Welcome to DrRacket, version 5.3.2.3--2013-01-29(32529d89/d) [3m].<br>
>> > Language: racket; memory limit: 128 MB.<br>
>> >> (integer->roman 3.3)<br>
>> > . . integer->roman: contract violation<br>
>> > expected: integer?<br>
>> > given: 3.3<br>
>> >> (integer->roman 3.3)<br>
>> > . . integer->roman: contract violation<br>
>> > expected: integer?<br>
>> > given: 3.3<br>
>> >><br>
>> ><br>
>> ><br>
>> > On Tue, Jan 29, 2013 at 4:33 PM, Pierpaolo Bernardi<br>
>> > <<a href="mailto:olopierpa@gmail.com">olopierpa@gmail.com</a>>wrote:<br>
>> ><br>
>> >> If I use raise-argument-error in my functions, like this:<br>
>> >><br>
>> >> (define (integer->roman n)<br>
>> >> (cond ((not (integer? n))<br>
>> >> (raise-argument-error 'integer->roman "integer?" n))<br>
>> >> ((positive? n)<br>
>> >> (apply string-append (positive-integer->roman n)))<br>
>> >> ((negative? n)<br>
>> >> (apply string-append "NEGATIVVS " (positive-integer->roman (-<br>
>> >> n))))<br>
>> >> (else<br>
>> >> "NVLLA")))<br>
>> >><br>
>> >> I get errors like this:<br>
>> >><br>
>> >> Welcome to DrRacket, version 5.3.2.2--2013-01-26(88404f3/a) [3m].<br>
>> >> Language: racket [custom].<br>
>> >> > (integer->roman 3.3)<br>
>> >> integer->roman: contract violation<br>
>> >> expected: integer?<br>
>> >> given: 3.3<br>
>> >> > (integer->roman 3.3)<br>
>> >> . . C:\Program<br>
>> >> Files\Racket-Full-5.3.2.2\collects\racket\private\more-scheme.rkt:263:2:<br>
>> >> integer->roman: contract violation<br>
>> >> expected: integer?<br>
>> >> given: 3.3<br>
>> >><br>
>> >> That is, from the second time on I get the extraneous prefix. Is this<br>
>> >> expected?<br>
>> >><br>
>> >> P.<br>
>> >><br>
>> >><br>
>> >> _________________________<br>
>> >> Racket Developers list:<br>
>> >> <a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
>> >><br>
>> >><br>
>> ><br>
>><br>
>> --<br>
>> Inviato dal mio dispositivo mobile<br>
>><br>
><br>
<br>
--<br>
Inviato dal mio dispositivo mobile<br>
</div></div></blockquote></div><br></div>