[racket] a few questions while reading about racket/draw libray

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Sep 14 17:05:21 EDT 2012

At Fri, 14 Sep 2012 13:12:11 -0400, J G Cho wrote:
> Q1. Possible syntax error?
> 
> Code that generates Racketeers, ho! (with reflections) near the bottom
> of the tutorial, goes like this:
> 
> (define-values (tw th)
>   (let-values ([(tw th 1 2)
>                 (send dc get-text-extent str the-font)])
>     (values (inexact->exact (ceiling tw))
>             (inexact->exact (ceiling th)))))
> 
> It gives me an error (5.3 on Win 7). I changed 1 2 to to x y.
> 
> (define-values (tw th)
>   (let-values ([(tw th x y) ....

Thanks! I'll fix this soon.

> Q2. It's too late to change syntax from (send obj method) to [obj
> method], isn't it?

Yes. :)

> Q3. Is there some general rules or convention w.r.t. (new obj% ) vs (make-obj) 
> ?

I'd encourage `new' over `make-object'.

There are a few places where overloadings (that have been carried over
from the earliest versions) defeat `new', and in those case, we've
started introducing even better `make-' functions.

Looking through the `racket/draw' overview, I see `(make-object color%
...)' and `(make-object font% ...)' that would be better as
`(make-color ...)' and `(make-font ...)', and I'll change those.


Posted on the users mailing list.