[plt-scheme] Re: MrEd - Gui

From: Matt Jadud (jadudm at gmail.com)
Date: Sun Sep 30 11:11:00 EDT 2007

On 9/30/07, Laurent <Ouaibou at gmail.com> wrote:
> >(define (interpretation-show)
> >  (if (send scheme-editor is-shown?)
> >      (send editor-hdragable delete-child scheme-editor)
> >      (send editor-hdragable add-child scheme-editor)))

> This perform, but DrScheme send me an error :
>
> >procedure application: expected procedure, given: #<void> (no arguments)
>
> from :
> >(callback (lambda (item event) ((interpretation-show))))
>
> I don't understand why ?

Hi Laurent,

I still write contracts for all of my functions. Actually,  I often
use the contract library, but for the moment, a good comment will do.

;; CONTRACT
;; interpretation-show : __ -> void
;; PURPOSE
;; Send a message to the editor to delete or add a child.

The result of 'send' in both branches of your 'if' is... well, I don't
know for sure, but it's probably void.

And then you call the function, and invoke it, in your callback:

((interpretation-show))

This is the invocation of a function with zero arguments:

(interpretation-show)

and this is the invocation of the result of that function:

((interpretation-show))

Does that make sense?

Cheers,
Matt


Posted on the users mailing list.