[APBeta] Parameter defaults

Paul Rodman paul at ilanga.com
Fri Jan 9 16:21:12 PST 2009


On Jan 9, 2009, at 04:09 PM, Gary A. Ferguson wrote:

> I keep having to change lines like:
> c=new Canvas(800,1000,"Magnification")
> into lines like:
> c=new Canvas(800,1000,nil,"Magnification",true)
> which is fine, things change, it's a new version after all. But why  
> can't I use:
> c=new Canvas(800,1000,,"Magnification") ?
>
> The 2 new fields in the constructor appear to be defaulted according  
> to the framework, so it seems like I shouldn't have to provide  
> explicit values. Is this just something about the particular version  
> of BASIC that I don't understand?

I dunno. Well, perhaps I do - it's just that I've never tried this:

I was recently told by the vendor that if you have your main program  
in a script not encapsulated in a method, then a lot of the "syntactic  
sugar" one would expect is not available to you. I suspect embedded  
default parameters might be included in this.

For this reason (and others) I am contemplating forcing the script  
writer to encapsulate their main program code in a "main" subroutine,  
which I would then call. Of course, this would mean that all V1  
scripts would need tweaking, but then that's probably the case anyway.

Try putting your main program in a sub(routine) and calling it:

   sub main()
      ...
      program statements
      ...
   end sub

   main()   // Call main

and see if that resolves the issue. Let me know.

Paul R.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.astroplanner.net/pipermail/apbeta-astroplanner.net/attachments/20090109/4f7111a0/attachment-0003.htm>


More information about the APBeta mailing list