Re: [racket-dev] differences in error reporting

2013-01-31 Thread Robby Findler
Sorry for the delay in getting back to you.

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.

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:

#lang racket
(define (f x) (+ 1 (car x)))
(f 11)

you'll see highlighting around the car expression directly.

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:

#lang racket
(define (f x) (+ 1 (car x)))
(unless (zero? (random 1)) (set! f 12))
(f 11)

If none of those are around, you get no source location printed out.

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.

... 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.

hth,
Robby



On Tue, Jan 29, 2013 at 8:21 PM, Pierpaolo Bernardi wrote:

> AHA! You got it!
>
> It happens in the tabs which have 'No debugging...' checked, and
> doesn't happen otherwise.
>
>
> 2013/1/30, Robby Findler :
> > What is the "custom" part of the language settings you have on?
> >
> > Robby
> >
> >
> > On Tue, Jan 29, 2013 at 7:47 PM, Pierpaolo Bernardi
> > wrote:
> >
> >> Update 2: it does not depend on buffer content.
> >>
> >> I have 9 tab open in this DrRacket. In 5 of them happen the strange
> >> message, in 4 of them it doesn't happen.
> >>
> >> I tried closing one in which it happened and then reopening the same
> >> file in a new tab, and in the new tab it doesn't happen.
> >>
> >>
> >> 2013/1/30, Robby Findler :
> >> > I don't see that with this program:
> >> >
> >> > #lang racket
> >> >
> >> > (define (integer->roman n)
> >> >   (cond ((not (integer? n))
> >> >  (raise-argument-error 'integer->roman "integer?" n))
> >> > ((positive? n)
> >> >  (apply string-append n))
> >> > ((negative? n)
> >> >  (apply string-append "NEGATIVVS " 1))
> >> > (else
> >> >  "NVLLA")))
> >> >
> >> > Welcome to DrRacket, version 5.3.2.3--2013-01-29(32529d89/d) [3m].
> >> > Language: racket; memory limit: 128 MB.
> >> >> (integer->roman 3.3)
> >> > . . integer->roman: contract violation
> >> >   expected: integer?
> >> >   given: 3.3
> >> >> (integer->roman 3.3)
> >> > . . integer->roman: contract violation
> >> >   expected: integer?
> >> >   given: 3.3
> >> >>
> >> >
> >> >
> >> > On Tue, Jan 29, 2013 at 4:33 PM, Pierpaolo Bernardi
> >> > wrote:
> >> >
> >> >> If I use raise-argument-error in my functions, like this:
> >> >>
> >> >> (define (integer->roman n)
> >> >>   (cond ((not (integer? n))
> >> >>  (raise-argument-error 'integer->roman "integer?" n))
> >> >> ((positive? n)
> >> >>  (apply string-append (positive-integer->roman n)))
> >> >> ((negative? n)
> >> >>  (apply string-append "NEGATIVVS " (positive-integer->roman
> (-
> >> >> n
> >> >> (else
> >> >>  "NVLLA")))
> >> >>
> >> >> I get errors like this:
> >> >>
> >> >> Welcome to DrRacket, version 5.3.2.2--2013-01-26(88404f3/a) [3m].
> >> >> Language: racket [custom].
> >> >> > (integer->roman 3.3)
> >> >> integer->roman: contract violation
> >> >>   expected: integer?
> >> >>   given: 3.3
> >> >> > (integer->roman 3.3)
> >> >> . . C:\Program
> >> >>
> Files\Racket-Full-5.3.2.2\collects\racket\private\more-scheme.rkt:263:2:
> >> >> integer->roman: contract violation
> >> >>   expected: integer?
> >> >>   given: 3.3
> >> >>
> >> >> That is, from the second time on I get the extraneous prefix.  Is
> this
> >> >> expected?
> >> >>
> >> >> P.
> >> >>
> >> >>
> >> >> _
> >> >>   Racket Developers list:
> >> >>   http://lists.racket-lang.org/dev
> >> >>
> >> >>
> >> >
> >>
> >> --
> >> Inviato dal mio dispositivo mobile
> >>
> >
>
> --
> Inviato dal mio dispositivo mobile
>
_
  

[racket-dev] Why is the Systems Programming guide using console-oriented Racket?

2013-01-31 Thread Danny Yoo
Is there a pedagogic reason why the Systems Programming guide
explicitly discourages running through DrRacket?

There's a leading paragraph in the intro:

To get into the spirit of this tutorial, we suggest that you set
DrRacket aside for a moment, and switch to raw racket in a terminal.

But frankly, I don't get this.
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Why is the Systems Programming guide using console-oriented Racket?

2013-01-31 Thread Sam Tobin-Hochstadt
It emphasizes that Racket is broadly applicable, and works both in an
IDE environment, and in a text editor/shell environment, each of which
is preferred by large groups of developers.

Sam

On Thu, Jan 31, 2013 at 2:38 PM, Danny Yoo  wrote:
> Is there a pedagogic reason why the Systems Programming guide
> explicitly discourages running through DrRacket?
>
> There's a leading paragraph in the intro:
>
> To get into the spirit of this tutorial, we suggest that you set
> DrRacket aside for a moment, and switch to raw racket in a terminal.
>
> But frankly, I don't get this.
> _
>   Racket Developers list:
>   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Why is the Systems Programming guide using console-oriented Racket?

2013-01-31 Thread Danny Yoo
On Thu, Jan 31, 2013 at 4:01 PM, Sam Tobin-Hochstadt  wrote:
> It emphasizes that Racket is broadly applicable, and works both in an
> IDE environment, and in a text editor/shell environment, each of which
> is preferred by large groups of developers.

Ok, this idea is important.  I'm just not sure that it should be
introduced in the Systems Programming guide.


It might (has!) lead to some confusion, especially since by using
enter!, it implicitly involves module paths.  If you look closely at
the user transcript in:

http://lists.racket-lang.org/users/archive/2013-January/056208.html

the user did some pretty reasonable looking things, but all hitting
module path vs. regular paths issue.
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Why is the Systems Programming guide using console-oriented Racket?

2013-01-31 Thread Eli Barzilay
Also, no matter what you do, there are a certain kind of hackers that
will never dump their console for all the gui in the world.  (And the
size of this crown is not negligible.)


Four hours ago, Sam Tobin-Hochstadt wrote:
> It emphasizes that Racket is broadly applicable, and works both in
> an IDE environment, and in a text editor/shell environment, each of
> which is preferred by large groups of developers.
> 
> Sam
> 
> On Thu, Jan 31, 2013 at 2:38 PM, Danny Yoo  wrote:
> > Is there a pedagogic reason why the Systems Programming guide
> > explicitly discourages running through DrRacket?
> >
> > There's a leading paragraph in the intro:
> >
> > To get into the spirit of this tutorial, we suggest that you set
> > DrRacket aside for a moment, and switch to raw racket in a terminal.
> >
> > But frankly, I don't get this.

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
http://barzilay.org/   Maze is Life!
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Why is the Systems Programming guide using console-oriented Racket?

2013-01-31 Thread Danny Yoo
On Thu, Jan 31, 2013 at 8:23 PM, Eli Barzilay  wrote:
> Also, no matter what you do, there are a certain kind of hackers that
> will never dump their console for all the gui in the world.  (And the
> size of this crown is not negligible.)


Ok.  I think Matthew's note is good enough then.
_
  Racket Developers list:
  http://lists.racket-lang.org/dev