[racket] REPL @ Runtime Contract Modification?
Thanks, that's what I wanted.
But unfortunately it doesn't work as the function apparently was
compiled inline or something to that effect.
As a more general solution to this kind of interactive debugging issue,
how difficult would implementing a typical Common Lisp REPL be? I'm
thinking of adding the kind of error/condition handler like:
"<error or condition goes here>
enter a number:
0 - enter new value
1 - exit to top level
2 - exit one level
3 - print stack trace
4 - etc.
I'm not familiar with Racket's internals so I don't know how much this
is a REPL hack vs. rewriting the whole system (the condition system
isn't necessary)... If it's not too impossible I would be happy to make
this contribution...
On 06/27/2013 12:14 PM, Matthias Felleisen wrote:
> Got it.
>
> Assuming f is assignable:
> -- define a new version of the function with its improved contract
> (define/contract fprime ...)
> -- (set! f fprime)
>
>
>
>
>
> On Jun 27, 2013, at 10:53 AM, Sean Kanaley <skanaley at gmail.com> wrote:
>
>> All of Racket seems to be available while debugging GUIs. I can query state and launch new error-free dialogs while the GUI sits there with its broken dialog. I was thinking then that there might be some way to change the associated contract of the offending function while the GUI patiently waits for its next event.
>>
>> Also it was type [A]...I made the mistake of calling the range of a function like "member" "boolean?".
>>
>> The goal is to enter:
>>
>> (set-contract! <function> (-> ... (listof symbol?))
>>
>> and carry on.
>>
>> On 06/27/2013 10:32 AM, Matthias Felleisen wrote:
>>> I am not sure what you're asking.
>>>
>>> -- Once your program has raised a contract error and your program didn't handle it, you're stuck.
>>>
>>> -- Did the contract error suggest
>>>
>>> [A] you formulated the wrong contract (the program is working but the contract is too stringent)
>>> [B] you program has a bug
>>>
>>> Before you restart try to figure out which one is which and fix something.
>>>
>>>
>>>
>>>
>>> On Jun 27, 2013, at 12:35 AM, Sean Kanaley <skanaley at gmail.com> wrote:
>>>
>>>> Hello,
>>>>
>>>> I'm debugging a heavily stateful GUI app that has reached a very specific state but has come across a contract error. Is there some way to modify the contract and proceed or I must I reevaluate and run the gui and attempt to duplicate the state?
>>>> ____________________
>>>> Racket Users list:
>>>> http://lists.racket-lang.org/users