[plt-scheme] Unhygienic macro not needed?
Ok, I quite agree with you. Indeed my little tests did not show any
significant difference.
Laurent
On Fri, Nov 20, 2009 at 17:32, Carl Eastlund <carl.eastlund at gmail.com>wrote:
> On Fri, Nov 20, 2009 at 11:25 AM, Laurent <laurent.orseau at gmail.com>
> wrote:
> >
> > On Fri, Nov 20, 2009 at 17:14, Carl Eastlund <carl.eastlund at gmail.com>
> > wrote:
> >>
> >> On Fri, Nov 20, 2009 at 10:55 AM, Joe Marshall <jmarshall at alum.mit.edu>
> >> wrote:
> >> > On Fri, Nov 20, 2009 at 5:57 AM, Laurent <laurent.orseau at gmail.com>
> >> > wrote:
> >> >>
> >> >> I have the following (simplified) code :
> >> >>
> >> >> (define (f1 x)
> >> >> (let ([y (foo x)])
> >> >> (bar x y y)
> >> >> (plop y x y)
> >> >> (baz x y)))
> >> >>
> >> >> (define (f2 x)
> >> >> (let ([y (foo x)])
> >> >> (baz x y)))
> >> >
> >> > (define (wrapper receiver)
> >> > (lambda (x)
> >> > (let ((y (foo x)))
> >> > (receiver x y)
> >> > (baz x y))))
> >> >
> >> > (define f1
> >> > (wrapper
> >> > (lambda (x y)
> >> > (bar x y y)
> >> > (plop y x y) )))
> >> >
> >> > (define f2
> >> > (wrapper
> >> > (lambda (x y) #f)))
> >>
> >> Oops. Joe, of course, has the best solution. No need for "macrology"
> >> when "functionality" does the job. Pardon the puns.
> >
> > But this introduces a (little?) run-time cost, doesn't it?
>
> Two responses. One, code clarity is almost always more important than
> tiny runtime costs. Two, no it doesn't, as long as the compiler is
> even halfway intelligent about inlining and constant propagation.
> Trust the compiler. If it's good, it's often smarter about optimizing
> your code than you are. If it's bad, your code is never going to run
> fast anyway.
>
> --Carl
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20091120/92427e5a/attachment.html>