1
0
Fork 0
cl-sites/guile.html_node/Programming-Options.html

116 lines
5.5 KiB
HTML
Raw Normal View History

2024-12-17 12:49:28 +01:00
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This manual documents Guile version 3.0.10.
Copyright (C) 1996-1997, 2000-2005, 2009-2023 Free Software Foundation,
Inc.
Copyright (C) 2021 Maxime Devos
Copyright (C) 2024 Tomas Volf
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled "GNU Free
Documentation License." -->
<title>Programming Options (Guile Reference Manual)</title>
<meta name="description" content="Programming Options (Guile Reference Manual)">
<meta name="keywords" content="Programming Options (Guile Reference Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content=".texi2any-real">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Programming-Overview.html" rel="up" title="Programming Overview">
<link href="User-Programming.html" rel="next" title="User Programming">
<link href="Testbed-Example.html" rel="prev" title="Testbed Example">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
ul.mark-bullet {list-style-type: disc}
-->
</style>
<link rel="stylesheet" type="text/css" href="https://www.gnu.org/software/gnulib/manual.css">
</head>
<body lang="en">
<div class="subsection-level-extent" id="Programming-Options">
<div class="nav-panel">
<p>
Next: <a href="User-Programming.html" accesskey="n" rel="next">How About Application Users?</a>, Previous: <a href="Testbed-Example.html" accesskey="p" rel="prev">Example: Using Guile for an Application Testbed</a>, Up: <a href="Programming-Overview.html" accesskey="u" rel="up">An Overview of Guile Programming</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="A-Choice-of-Programming-Options"><span>5.7.4 A Choice of Programming Options<a class="copiable-link" href="#A-Choice-of-Programming-Options"> &para;</a></span></h4>
<p>The preceding arguments and example point to a model of Guile
programming that is applicable in many cases. According to this model,
Guile programming involves a balance between C and Scheme programming,
with the aim being to extract the greatest possible Scheme level benefit
from the least amount of C level work.
</p>
<p>The C level work required in this model usually consists of packaging
and exporting functions and application objects such that they can be
seen and manipulated on the Scheme level. To help with this, Guile&rsquo;s C
language interface includes utility features that aim to make this kind
of integration very easy for the application developer.
</p>
<p>This model, though, is really just one of a range of possible
programming options. If all of the functionality that you need is
available from Scheme, you could choose instead to write your whole
application in Scheme (or one of the other high level languages that
Guile supports through translation), and simply use Guile as an
interpreter for Scheme. (In the future, we hope that Guile will also be
able to compile Scheme code, so lessening the performance gap between C
and Scheme code.) Or, at the other end of the C&ndash;Scheme scale, you
could write the majority of your application in C, and only call out to
Guile occasionally for specific actions such as reading a configuration
file or executing a user-specified extension. The choices boil down to
two basic questions:
</p>
<ul class="itemize mark-bullet">
<li>Which parts of the application do you write in C, and which in Scheme
(or another high level translated language)?
</li><li>How do you design the interface between the C and Scheme parts of your
application?
</li></ul>
<p>These are of course design questions, and the right design for any given
application will always depend upon the particular requirements that you
are trying to meet. In the context of Guile, however, there are some
generally applicable considerations that can help you when designing
your answers.
</p>
<ul class="mini-toc">
<li><a href="Available-Functionality.html" accesskey="1">What Functionality is Already Available?</a></li>
<li><a href="Basic-Constraints.html" accesskey="2">Functional and Performance Constraints</a></li>
<li><a href="Style-Choices.html" accesskey="3">Your Preferred Programming Style</a></li>
<li><a href="Program-Control.html" accesskey="4">What Controls Program Execution?</a></li>
</ul>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="User-Programming.html">How About Application Users?</a>, Previous: <a href="Testbed-Example.html">Example: Using Guile for an Application Testbed</a>, Up: <a href="Programming-Overview.html">An Overview of Guile Programming</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>