Re: [Gimp-developer] scheme changes

2007-04-16 Thread Simon Budig
Renan Birck Pinheiro ([EMAIL PROTECTED]) wrote:
 Em Sáb, 2007-04-14 às 18:37 -0500, Jim Sabatke escreveu:
  I have a lot of scripts that no longer work under 2.3.x.  I
  understand that gimp has migrated to tiny scheme and variables need
  to be declared with let or let*.  I have tried and tried to modify
  some of the scripts and can't get them to work.  I've looked at
  examples of scripts that do work and I've gone over (and over) the
  syntax for 'let' in my Lisp books, all to no avail. 
 
 This might or might not be what you want, but for most of my scripts,
 replacing set! by define worked. 

I do believe that properly scoping the variables within a let*-block
would be more appropriate here. However, I really cannot tell without
looking at the problematic scripts. I'd be glad to discuss the issues on
this list, if someone could summarize this into a tutorial or something
I'd be glad to put it on the website.

Bye,
Simon
-- 
  [EMAIL PROTECTED]  http://simon.budig.de/
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] scheme changes

2007-04-16 Thread Kevin Cozens
Jim Sabatke wrote:
 I understand 
 that gimp has migrated to tiny scheme and variables need to be declared 
 with let or let*.  I have tried and tried to modify some of the scripts 
 and can't get them to work.
[snip]
 The documents on the let and let* functions make it seem like I 
 shouldn't be having this much trouble.

I realize that Scheme code looks rather cryptic to a lot of people but, no, 
you shouldn't be having that much trouble.

What doesn't help matters is that a lot of Scheme code is poorly formatted 
making it look like something suitable for submission to an Obufuscated Scheme 
contest. When the code is properly formatted it is much easier to see the 
syntax of the lanuage. This also makes it easier to modify Scheme code and 
eliminates so much of the time one otherwise spends counting brackets.

As someone else mentioned, you can cheat and just change the 'set!' calls to 
'define'. However, putting the undefined variables in a let/let* block is 
preferred.

A let block looks like the following:
(let* (
   (var1 value-or-code-to-give-initial-value-for-variable)
   (var2 some-other-value)
   )
   ... scheme code ...
)

If your script gives you an error message along the line of 'unbound variable: 
bad-var', you just need to add 'bad-var' to the let block.

(let* (
   (var1 value-or-code-to-give-initial-value-for-variable)
   (var2 some-other-value)
   (bad-var)
   )
   ... scheme code ...
)

You don't have to even have to specify a value if you don't want to. 
Alternatively, you could take the entire Scheme set! statement where bad-var 
is first used and put it in the header without the leading set! command where 
I showed '(bad-var)'.

--
Cheers!

Kevin.

http://www.ve3syb.ca/   |What are we going to do today, Borg?
Owner of Elecraft K2 #2172  |Same thing we always do, Pinkutus:
 |  Try to assimilate the world!
#include disclaimer/favourite |  -Pinkutus  the Borg
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] scheme changes

2007-04-14 Thread Renan Birck Pinheiro
Em Sáb, 2007-04-14 às 18:37 -0500, Jim Sabatke escreveu:
 I have a lot of scripts that no longer work under 2.3.x.  I
 understand 
 that gimp has migrated to tiny scheme and variables need to be
 declared 
 with let or let*.  I have tried and tried to modify some of the
 scripts 
 and can't get them to work.  I've looked at examples of scripts that
 do 
 work and I've gone over (and over) the syntax for 'let' in my Lisp 
 books, all to no avail. 

This might or might not be what you want, but for most of my scripts,
replacing set! by define worked. 

I found this hint, but is in Portuguese:

http://cadafalso.deusexmachina.com.br/2007/01/17/erros-no-gimp-2313/

hth,
Renan Renan_S2 Birck

___
Gimp-developer mailing list
[EMAIL PROTECTED]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer