Hi andreas That looks very good to me...thank you very much indeed! Best Regards Dean
On 10 February 2017 at 17:12, <[email protected]> wrote: > Hi Dean > > PicoLisp is an interpreted language, so very dynamic. > Therefore, why not just do it with a global flag variable? > > (off *Scaffolding) # do not load scaffolding > > .... > > (de myCode ...) > > (when *Scaffolding > (de myScaffoldingFunc1 ...) > (de myScaffoldingFunc2 ...) > (de myScaffoldingFunc3 ...) ) > > > So all the (de) is only executed if *Scaffolding is not NIL. > (off *Scaffolding) sets global variable *Scaffolding to NIL. > (on *Scaffolding) sets global variable to T (used as true in picolisp). > > This can be made even shorter: > > (off *Scaffolding) # or (on *Scaffolding), depending on context > > .... > > (de myCode ...) > > `*Scaffolding # evaluate *Scaffolding during reading of the source file, > when its NIL, (load)ing stops > > (de myScaffoldingFunc1 ...) > (de myScaffoldingFunc2 ...) > (de myScaffoldingFunc3 ...) > > Regards, > beneroth > > > ----- Original Message ----- > From: dean [mailto:[email protected]] > To: [email protected] > Sent: Wed, 8 Feb 2017 16:31:30 +0000 > Subject: Re: unit testing? > > Hi Alex and Christophe > In Python that __name__ variable stops things like a local main proc from > executing altogether...when Python detects that the module in which it > exists no longer needs it because it is being loaded by a bigger program, > which accesses the module's code like the local main does i.e. The local > main is hidden from Python under such circumstances. > > I was wondering about the "once" situation too....because I have > experienced "function redeclared" or some such popping up. If you're > telling me that such messages are inconsequential compared to the benefits > of developing in a way which causes that.....that's fine by me because it's > easier to ignore the redeclaration messages than not :) > > Because PL seems to allow forward referencing...I was.... > 1 Putting all the scaffolding down the bottom with my local main so it's > all in the same place. > 2 Commenting it all out... > 3 Loading the module into the wider program and then > 4 Comment the helper functions back in as PL reported their absence. > Obviously the local main stays commented out. > This seems fairly convenient but my interpretation of the above is I only > need to comment out the local main and if that's right that's great. > > Thank you Chrostophe for the further explanation re Python. > > Best Regards > Dean > > > > > > > On 8 February 2017 at 14:47, Christophe Gragnic < > [email protected] > > wrote: > > > On Wed, Feb 8, 2017 at 12:13 PM, Alexander Burger <[email protected]> > > wrote: > > >> I'm thinking of Python's `if __name__ == '__main__' and Perl's unless > > >> (caller) {...} > > > > > > I don't know Python and Perl well enough. But perhaps 'once' is what > you > > think > > > of? > > > > > > (once (load "xxx.l")) > > > > No, it's different. > > > > In Python there's a «magic» variable named __name__. > > As files can be: > > - imported from another script/module > > - interpreted directly from top leve > > it provides a trick to distinguish between those two ways to use a > > script/module. > > See here: > > https://docs.python.org/3/library/__main__.html > > > > > > chri > > -- > > UNSUBSCRIBE: mailto:[email protected]?subjectUnsubscribe > > > > >
