I am creating a compiledBlock at runtime, then invoking it.
This works just fine. I put a halt in it, and it halts, but the debugger will not step, it just finishes the block in a single step no matter what -- gives the right answer. What am I doing wrong -- or can I not do this at all?? -- Dennis Smith +1 416.798.7948 Cherniak Software Development Corporation Fax: +1 416.798.0948 509-2001 Sheppard Avenue East [hidden email] Toronto, ON M2J 4Z8 sip:[hidden email] Canada http://www.CherniakSoftware.com Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP |
Hm -- OK -- maybe its how I invoked the compiler. What I wanted was
the compiled block to store
in an ivar to use over and over -- so Here is what I did evaluate: textOrString for: anObject in: aNameSpace notifying: aController logged: logFlag | m | m := Compiler new compile: textOrString in: nil allowReceiver: false class: anObject class environment: aNameSpace noPattern: true notifying: aController ifFail: [self errorMsg: 'Syntax error in - ', textOrString. ^nil] handler: (PPcompilerErrorHandler new editor: aController). m isString ifTrue: [self error: m]. m == false ifTrue: [^nil]. ^nil performMethod: m The "aController" and the "PPcompilerErrorHandler" stuff is mine -- to try and get a reasonable handle on compile errors. A block might look something like ^[:array | | v1 v2 v3 v4 | v1 := array at: 1. v2 := array at: 2. ... [ .. expression using v1,v2,v3,v4 ... ] ensure: [ array at: 1 put: v1. array at: 2 put: v2. ...]. array] What this is used for is to let end-users (intelligent ones) put ST expressions into a text field on a GUI, save it and later run it. My specific case right now is a payroll system where the tax tables are just plugged in formulae which are executed at payrun time -- many many many times, which is why I wanted the compiled block to use. Just out of interest -- this code runs on both VW and Gemstone (the code to compile for gemstone is different of course). Terry Raymond wrote: Dennis Send me a simple example and I will look at it. Also, what version of vw are you using? Terry =========================================================== Terry Raymond Smalltalk Professional Debug Package Crafted Smalltalk 80 Lazywood Ln. Tiverton, RI 02878 (401) 624-4517 [hidden email] <http://www.craftedsmalltalk.com> ===========================================================-----Original Message----- From: Dennis Smith [[hidden email]] Sent: Wednesday, April 25, 2007 2:46 PM To: VWNC, Subject: Debugging as block compiled at runtime ... I am creating a compiledBlock at runtime, then invoking it. This works just fine. I put a halt in it, and it halts, but the debugger will not step, it just finishes the block in a single step no matter what -- gives the right answer. What am I doing wrong -- or can I not do this at all?? -- Dennis Smith +1 416.798.7948 Cherniak Software Development Corporation Fax: +1 416.798.0948 509-2001 Sheppard Avenue East [hidden email] Toronto, ON M2J 4Z8 <a class="moz-txt-link-freetext" href="sip:dennis@CherniakSoftware.com">sip:dennis@... Canada http://www.CherniakSoftware.com Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP -- Dennis Smith +1 416.798.7948 Cherniak Software Development Corporation Fax: +1 416.798.0948 509-2001 Sheppard Avenue East [hidden email] Toronto, ON M2J 4Z8 <a class="moz-txt-link-freetext" href="sip:dennis@CherniakSoftware.com">sip:dennis@... Canada http://www.CherniakSoftware.com Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP |
I would think that to get the block in an assignable
form,
variable := Compiler evaluate: '[:array | ... ]'. would be simpler. Doing that doesn't seem to cause any problems with proceeding. I'll note that WebToolkit does something vaguely similar with creating and caching the compiled representation of server pages. The various ...PageCompiler classes might be useful to look at as examples of doing the more complicated thing. At 03:34 PM 4/25/2007, Dennis Smith wrote: Hm -- OK -- maybe its how I invoked the compiler. What I wanted was the compiled block to store Dennis Send me a simple example and I will look at it. Also, what version of vw are you using? Terry =========================================================== Terry Raymond Smalltalk Professional Debug Package Crafted Smalltalk 80 Lazywood Ln. Tiverton, RI 02878 (401) 624-4517 [hidden email] < http://www.craftedsmalltalk.com > ===========================================================
-- Dennis Smith --
Alan Knight [|], Cincom Smalltalk Development
"The Static Typing Philosophy: Make it fast. Make it right.
Make it run." - Niall Ross
|
Alan Knight wrote: I would think that to get the block in an assignable form,I figured I might have to do that -- I was trying to compile to get nice error messages with pointers into the source -- but hey I can do that and then get the useable result using the above. Mostly this is likely to run on Gemstone anyway, so performance (doing it twice) is not an issue here. I will try that -- thanks! would be simpler. Doing that doesn't seem to cause any problems with proceeding. -- Dennis Smith +1 416.798.7948 Cherniak Software Development Corporation Fax: +1 416.798.0948 509-2001 Sheppard Avenue East [hidden email] Toronto, ON M2J 4Z8 [hidden email] Canada http://www.CherniakSoftware.com Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP |
Free forum by Nabble | Edit this page |