* Guile and Swig @ 2013-04-17 5:28 Dmitry Bogatov 2013-04-19 0:06 ` Daniel Hartwig 2013-04-20 13:51 ` Guile and Swig Ludovic Courtès 0 siblings, 2 replies; 6+ messages in thread From: Dmitry Bogatov @ 2013-04-17 5:28 UTC (permalink / raw) To: guile-devel Hello, list! Is using SWIG[1] is endorsed for writing Guile wrappers to C library? I make such bindings for libircclient[2] for my project, but it would be nice, if it would find way to official Guile tree. Are here some guidelines about it? Also, question of style of Lisp code. It seems, that most common style is `(action object arg1 ...)` and I find making object callable is more elegant: `(object #:action arg1 ...)`. Is it discouraged? 1. http://www.swig.org/ 2. http://www.ulduzsoft.com/linux/libircclient/ -- Best regards, Dmitry Bogatov <KAction@gnu.org>, Free Software supporter and netiquette guardian. git://gitorious.org/illusionoflife-read-only/rc-files.git GPG: 54B7F00D Html mail and proprietary format attachments are forwarded to /dev/null. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Guile and Swig 2013-04-17 5:28 Guile and Swig Dmitry Bogatov @ 2013-04-19 0:06 ` Daniel Hartwig 2013-04-19 6:15 ` Guile lisp code style (was: [guile] Re: Guile and Swig) Dmitry Bogatov 2013-04-20 13:51 ` Guile and Swig Ludovic Courtès 1 sibling, 1 reply; 6+ messages in thread From: Daniel Hartwig @ 2013-04-19 0:06 UTC (permalink / raw) To: Dmitry Bogatov; +Cc: guile-devel On 17 April 2013 13:28, Dmitry Bogatov <KAction@gnu.org> wrote: > > Hello, list! > Hello now > Is using SWIG[1] is endorsed for writing Guile wrappers to C library? I > make such bindings for libircclient[2] for my project, but it would be > nice, if it would find way to official Guile tree. Are here some > guidelines about it? > The guile support in swig is under maintained at best. It may not even work correctly for guile-2.0. > Also, question of style of Lisp code. It seems, that most common style > is `(action object arg1 ...)` and I find making object callable is more > elegant: `(object #:action arg1 ...)`. Is it discouraged? On some level both styles are functionally equivalent, although conceptually they are quite different. It is more or less a matter of taste. However, certain tasks are easier in one style or the other. Why do you find the second style more elegant? ^ permalink raw reply [flat|nested] 6+ messages in thread
* Guile lisp code style (was: [guile] Re: Guile and Swig) 2013-04-19 0:06 ` Daniel Hartwig @ 2013-04-19 6:15 ` Dmitry Bogatov 2013-04-19 7:46 ` Daniel Hartwig 0 siblings, 1 reply; 6+ messages in thread From: Dmitry Bogatov @ 2013-04-19 6:15 UTC (permalink / raw) To: Daniel Hartwig; +Cc: guile-devel Daniel Hartwig <mandyke@gmail.com> writes: >> Also, question of style of Lisp code. It seems, that most common style >> is `(action object arg1 ...)` and I find making object callable is more >> elegant: `(object #:action arg1 ...)`. Is it discouraged? > On some level both styles are functionally equivalent, although > conceptually they are quite different. It is more or less a matter of > taste. However, certain tasks are easier in one style or the other. Of course. Essentially, it is question about object vs procedural style. > Why do you find the second style more elegant? I do not have to create a lot of foo-make-thing, foo-make-other functions with, essentially, elisp or C naming conventions. I still do not have feeling of functionality paradigm of Lisp, so I am trying to use object-oriented paradigm. Probably, it is aganist spirit of language. -- Best regards, Dmitry Bogatov <KAction@gnu.org>, Free Software supporter and netiquette guardian. git clone git://gitorious.org/illusionoflife-read-only/rc-files.git --depth 1 GPG: 54B7F00D Html mail and proprietary format attachments are forwarded to /dev/null. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Guile lisp code style (was: [guile] Re: Guile and Swig) 2013-04-19 6:15 ` Guile lisp code style (was: [guile] Re: Guile and Swig) Dmitry Bogatov @ 2013-04-19 7:46 ` Daniel Hartwig 0 siblings, 0 replies; 6+ messages in thread From: Daniel Hartwig @ 2013-04-19 7:46 UTC (permalink / raw) To: Dmitry Bogatov; +Cc: guile-devel On 19 April 2013 14:15, Dmitry Bogatov <KAction@gnu.org> wrote: > > Daniel Hartwig <mandyke@gmail.com> writes: >>> Also, question of style of Lisp code. It seems, that most common style >>> is `(action object arg1 ...)` and I find making object callable is more >>> elegant: `(object #:action arg1 ...)`. Is it discouraged? >> On some level both styles are functionally equivalent, although >> conceptually they are quite different. It is more or less a matter of >> taste. However, certain tasks are easier in one style or the other. > Of course. Essentially, it is question about object vs procedural style. > >> Why do you find the second style more elegant? > I do not have to create a lot of foo-make-thing, foo-make-other > functions with, essentially, elisp or C naming conventions. Ah. The module system in Guile alleviates the need to prefix all identifiers with ‘foo-’. You do not have to worry that potentially common names such as ‘make-session’ or ‘connect’ will interfere with bindings in other modules as namespaces are kept separate. In the event of a clash (i.e. my program imports your module and another which both define ‘connect’) it is trivial for me to refer precisely to the binding in your module, or install a prefix *as I use it*, etc.. This way, you can have short identifiers that are still globally unique. Bonus! > I still do not have feeling of functionality paradigm of Lisp, so I am > trying to use object-oriented paradigm. Probably, it is aganist spirit > of language. > I would not say against the spirit of the language, just uncommon. One reason to avoid the callable object style is to decouple interface and data, which is generally more convenient both logically and technically (i.e. implementing and extending). Even typical object systems in lisp (e.g. CLOS, GOOPS) avoid the style, prefering the common pattern of operator followed by data. There is nothing more or less “object oriented” about either style. It is really only on systems without multiple dispatch (e.g. C++, Python) that you see the “object”-first style. Due to requirements of single dispatch, one of the calls arguments must be blessed to determine which procedure implements the call. It is logical to make that the first argument, and from there only a small matter of emphasis to use "arg procedure" rather than "procedure arg". Personally, I say stick with ‘(procedure arg ...)’ unless there is a compelling logical reason to consider the interface and data tightly coupled. Taking a look at the libircclient C API, it does not appear that there is such a reason. All about 2c worth. Regards ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Guile and Swig 2013-04-17 5:28 Guile and Swig Dmitry Bogatov 2013-04-19 0:06 ` Daniel Hartwig @ 2013-04-20 13:51 ` Ludovic Courtès 2013-04-21 6:45 ` Ian Price 1 sibling, 1 reply; 6+ messages in thread From: Ludovic Courtès @ 2013-04-20 13:51 UTC (permalink / raw) To: guile-devel Hi! Dmitry Bogatov <KAction@gnu.org> skribis: > Is using SWIG[1] is endorsed for writing Guile wrappers to C library? I > make such bindings for libircclient[2] for my project, but it would be > nice, if it would find way to official Guile tree. Are here some > guidelines about it? As Daniel noted, this may not be a good idea these days. Besides, Guile 2.0 comes with two nice ways to write bindings: the FFI in the (system foreign) module, and its C API. It’s not automatic, but it many cases you may be able to come up with some level of project-specific automation on top of these. > Also, question of style of Lisp code. It seems, that most common style > is `(action object arg1 ...)` and I find making object callable is more > elegant: `(object #:action arg1 ...)`. Is it discouraged? I’ve never seen that second style in Scheme or even Lisp code. Even GOOPS, Guile’s object oriented layer, which derives from CLOS (Common Lisp’s), uses the first style. Ludo’. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Guile and Swig 2013-04-20 13:51 ` Guile and Swig Ludovic Courtès @ 2013-04-21 6:45 ` Ian Price 0 siblings, 0 replies; 6+ messages in thread From: Ian Price @ 2013-04-21 6:45 UTC (permalink / raw) To: Ludovic Courtès; +Cc: guile-devel [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=iso-2022-jp-2, Size: 624 bytes --] ludo@gnu.org (Ludovic Court^[$(D+2^[(Bs) writes: > I^[$B!G^[(Bve never seen that second style in Scheme or even Lisp code. I've seen it before in toy OO systems for Scheme. SICP uses it for a bit, as does the prometheus prototype OO library, and I believe Oleg's pure-fp OO example. > Even GOOPS, Guile^[$B!G^[(Bs object oriented layer, which derives from CLOS > (Common Lisp^[$B!G^[(Bs), uses the first style. As does Racket's class library through the 'send' form. -- Ian Price -- shift-reset.com "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled" ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-04-21 6:45 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-04-17 5:28 Guile and Swig Dmitry Bogatov 2013-04-19 0:06 ` Daniel Hartwig 2013-04-19 6:15 ` Guile lisp code style (was: [guile] Re: Guile and Swig) Dmitry Bogatov 2013-04-19 7:46 ` Daniel Hartwig 2013-04-20 13:51 ` Guile and Swig Ludovic Courtès 2013-04-21 6:45 ` Ian Price
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).