[Chicken-users] schemish/chickenish way to make configurable executables?
I'm curious to hear opinions on conditional complication and configuration using Chicken scheme. Say for example I want to enable or disable the use of a particular library or feature and I want there to be no trace of it in the executable. I can use a preprocessor such as cpp but I imagine there is a better way. Any strategies or methodologies you all can share? Are macros good for this? Thanks -- Matt -=- 90% of the nations wealth is held by 2% of the people. Bummer to be in the majority... ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] schemish/chickenish way to make configurable executables?
On Sat, Nov 02, 2013 at 11:35:22PM -0700, Matt Welland wrote: I'm curious to hear opinions on conditional complication and configuration using Chicken scheme. Say for example I want to enable or disable the use of a particular library or feature and I want there to be no trace of it in the executable. I can use a preprocessor such as cpp but I imagine there is a better way. Any strategies or methodologies you all can share? Are macros good for this? Hi Matt, Usually when I want to do something like this, I use cond-expand and provide the feature via -feature provide-foo: (define (foo) (cond-expand (provide-foo (do-whatever-foo-does)) (else (error support for foo is disabled This is used extensively by the crypt egg to select which fallback implementations need to be provided and for which implementations it can use the one provided by libc. This is of course only available when compiling from Scheme. If you want to ship precompiled C files (so you'll only need a C compiler and libchicken), you'd have to use C preprocessor and/or conditional compilation of various different implementation files through Make like CHICKEN itself does (for posixunix/posixwin, and for things like HAVE_POSIX_POLL). This is a lot trickier to do right, and I wouldn't recommend it unless you really have to. Cheers, Peter -- http://www.more-magic.net ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] schemish/chickenish way to make configurable executables?
Hi Peter, It looks like cond-expand does enough to achieve what I want. Thanks! Matt -=- On Sun, Nov 3, 2013 at 2:58 AM, Peter Bex peter@xs4all.nl wrote: On Sat, Nov 02, 2013 at 11:35:22PM -0700, Matt Welland wrote: I'm curious to hear opinions on conditional complication and configuration using Chicken scheme. Say for example I want to enable or disable the use of a particular library or feature and I want there to be no trace of it in the executable. I can use a preprocessor such as cpp but I imagine there is a better way. Any strategies or methodologies you all can share? Are macros good for this? Hi Matt, Usually when I want to do something like this, I use cond-expand and provide the feature via -feature provide-foo: (define (foo) (cond-expand (provide-foo (do-whatever-foo-does)) (else (error support for foo is disabled This is used extensively by the crypt egg to select which fallback implementations need to be provided and for which implementations it can use the one provided by libc. This is of course only available when compiling from Scheme. If you want to ship precompiled C files (so you'll only need a C compiler and libchicken), you'd have to use C preprocessor and/or conditional compilation of various different implementation files through Make like CHICKEN itself does (for posixunix/posixwin, and for things like HAVE_POSIX_POLL). This is a lot trickier to do right, and I wouldn't recommend it unless you really have to. Cheers, Peter -- http://www.more-magic.net -- Matt -=- 90% of the nations wealth is held by 2% of the people. Bummer to be in the majority... ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] schemish/chickenish way to make configurable executables?
There is also the feature-test egg which is useful in combination with the FFI. Jim On Nov 3, 2013, at 9:56, Matt Welland estifo...@gmail.com wrote: Hi Peter, It looks like cond-expand does enough to achieve what I want. Thanks! Matt -=- On Sun, Nov 3, 2013 at 2:58 AM, Peter Bex peter@xs4all.nl wrote: On Sat, Nov 02, 2013 at 11:35:22PM -0700, Matt Welland wrote: I'm curious to hear opinions on conditional complication and configuration using Chicken scheme. Say for example I want to enable or disable the use of a particular library or feature and I want there to be no trace of it in the executable. I can use a preprocessor such as cpp but I imagine there is a better way. Any strategies or methodologies you all can share? Are macros good for this? Hi Matt, Usually when I want to do something like this, I use cond-expand and provide the feature via -feature provide-foo: (define (foo) (cond-expand (provide-foo (do-whatever-foo-does)) (else (error support for foo is disabled This is used extensively by the crypt egg to select which fallback implementations need to be provided and for which implementations it can use the one provided by libc. This is of course only available when compiling from Scheme. If you want to ship precompiled C files (so you'll only need a C compiler and libchicken), you'd have to use C preprocessor and/or conditional compilation of various different implementation files through Make like CHICKEN itself does (for posixunix/posixwin, and for things like HAVE_POSIX_POLL). This is a lot trickier to do right, and I wouldn't recommend it unless you really have to. Cheers, Peter -- http://www.more-magic.net -- Matt -=- 90% of the nations wealth is held by 2% of the people. Bummer to be in the majority... ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users