[plt-scheme] on-execute method in drscheme:language:language<%>

From: Dale Vaillancourt (dalev at ccs.neu.edu)
Date: Fri Jun 16 11:44:10 EDT 2006

I need to "type-check" a program before running.  If it doesn't pass,  
I want to reject the attempt to run.  The checking is done by  
submitting the text in the definitions window to an external theorem  
prover.

You are right about execute-callback not being quite what I want,  
btw.  That captures all clicks on `Run', even when my language is not  
the one associated with the current tab.

-Dale

On Jun 16, 2006, at 11:16 AM, Robby Findler wrote:

> I'm not sure how to answer, because I think I'm missing some content:
> what do you want to do in a little bit more global sense? Still,  
> some minor comments below.
>
> At Fri, 16 Jun 2006 11:03:54 -0400, "Carl Eastlund" wrote:
>> On 6/16/06, Dale Vaillancourt <dalev at ccs.neu.edu> wrote:
>>> I am working on a language-level for DrScheme, and I need to do some
>>> computation when 'Run' is clicked (before allowing the user to
>>> interact with functions appearing in the definitions window).
>>>
>>> I thought that the right method to override would be on-execute in
>>> drscheme:language:language<%>, but that method gets invoked more
>>> often that I want.  In addition to being invoked upon clicking  
>>> 'Run',
>>> it also is invoked upon opening a file in DrScheme (when my language
>>> has already been selected).
>
> But the "Run" button is (implicitly) clicked at this point, with an
> empty program. In particular, the REPL is now active.
>
>>> Is there another method that only gets invoked upon clicking 'Run'?
>>> Alternatively, is there a way to determine, within the body of on-
>>> execute, whether the invocation was triggered by the 'Run' button?
>>>
>>> (BTW, I am using version 349.100-svn15jun2006.)
>>
>> I think you want the execute-callback method of drscheme:unit:frame%.
>> See also drscheme:get/extend:extend-unit-frame.
>
> Keep in mind that that method is invoked on drscheme's eventspace's
> main thread, not on the user's thread. (So, I doubt you want this.)
>
> Robby
>
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.