6 Aug 2012 08:13
In Scheme, what's the benefits and disadvantages with using a Scheme or FFI library for a given purpose?
Mikael <mikael.rcv <at> gmail.com>
2012-08-06 06:13:19 GMT
2012-08-06 06:13:19 GMT
(repost w more suitable title)
Below, I will understand that the use of SXML is made with the highly qualitative SSAX-SXML library, which has several parts (serialization, sxpath etc.) and is distributed for lots of Scheme implementations on a public domain basis. Essential parts of it are available as Black Hole modules for anyone for whom that might be of interest. Now:
What is advantageous of using SXML or LIBXML depends on the application.
Motivations for using a C library for a particular mechanism that is already implemented in very very well in Scheme would be, that you are using some code that requires you to use that C library anyhow, or, that there would happen to be some routines implemented in that C library that you need, are not in the Scheme library, and by some reason would be very time-consuming to implement.
Also of course, like Cyrille points out, there can be occasions when you want or need a specific library choice due to reasons relating to how you handle the code in your application, or the specific computer environment in which your application will execute.
From a very wide perspective, I relate to such occasions as very rare.
SXML is a data format standard that expresses the entire XML format in S-expression form. For several purposes this is highly usable.
As a general rule, processing Scheme objects rather than FFI objects carries many benefits with it: the language and routines for processing and manipulation available is extremely rich already (sporadic examples: iteration and serialization), your need of custom code for many operations is zero, and also as a sidenote the memory handling is implicit in all steps, including safety of memory fragmentation.
SXML is, generally speaking, an excellent example of when this applies. The only thing that SXML does not include, which a typical XML library does include, is a parent element attribute on (SXML/XML) elements. For the one for whom that would show to be relevant though, it's easy enough to implement, didn't hear anyone ask for that up to now though.
If you have further thoughts or questions please feel free to share,
_______________________________________________ Gambit-list mailing list Gambit-list <at> iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list