Re: [Gimp-user] procedure overloading in scheme / script-fu



On 12-09-18 06:42 PM, Gary Aitken wrote:
I assumed from the scheme manual that procedure-overloading
(in the form of different numbers of arguments) was permitted,
since, for example, there are two versions of string->number.

Scheme is not an OOP language so it does not support procedure overloading. If you look closely, you will see that string->number and number->string can take an optional parameter, a radix to use during the conversion. The optional radix parameter is not currently supported for either string->number or number->string.

Code to add support for the radix was supplied to the TinyScheme project and is currently being reviewed so radix support may be added soon to Script-Fu.

If you take the following code and run it in the script-fu console, it works;
but replacing all occurrances of "foo2" with "foo"
gets into an infinite loop (I guess; it never returns, in any case).

If you changed all foo2 to foo, then foo continually calls itself and the console will appear to hang.

--
Cheers!

Kevin.

http://www.ve3syb.ca/           |"Nerds make the shiny things that distract
Owner of Elecraft K2 #2172      | the mouth-breathers, and that's why we're
                                | powerful!"
#include <disclaimer/favourite> |             --Chris Hardwick



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]