Sven Neumann wrote:
> On Tue, 2007-01-30 at 09:11 +0200, Alexander Rabtchevich wrote:
>>      Raphaël, could you please explain me (I'm new to scheme) in a few 
>> words, why the global variables are poor style coding?
> 
> They are simply not allowed in Scheme.

Ok, that is the reason.

> 
>>  From my POV, they 
>> can only introduce memory consumption in common case (but not in the 
>> case of GIMP script-fu) and maybe some redefinitions in a large program 
>> (this doesn't concern Gimp also).
> 
> It does concern GIMP as all scripts live in the same namespace. A global
> variable defined in one script affects all other scripts.

Is the namespace cleared after script has finished its execution? And 
are there any scripts considered to run simultaneously?

> 
>>  But the inability to use global 
>> variables along with scheme syntaxes leads to a good deal of parentheses 
>> which could be a problem to a programmer.
> 
> I don't see how this introduces the need for more parentheses.
> 

;before
(set! selection-path (car (plug-in-sel2path
                           1
                           inImage
                           inLayer)))

;after
(let (selection-path (car (plug-in-sel2path
                           1
                           inImage
                           inLayer)))

...
   )

note the _closing_ parentheses which should include all the area of the 
variable definition.

-- 
With respect
Alexander Rabtchevich
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Reply via email to