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

137 lines
6.3 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>User Programming (Guile Reference Manual)</title>
<meta name="description" content="User Programming (Guile Reference Manual)">
<meta name="keywords" content="User Programming (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="Programming-Options.html" rel="prev" title="Programming Options">
<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="User-Programming">
<div class="nav-panel">
<p>
Previous: <a href="Programming-Options.html" accesskey="p" rel="prev">A Choice of Programming Options</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="How-About-Application-Users_003f"><span>5.7.5 How About Application Users?<a class="copiable-link" href="#How-About-Application-Users_003f"> &para;</a></span></h4>
<p>So far we have considered what Guile programming means for an
application developer. But what if you are instead <em class="emph">using</em> an
existing Guile-based application, and want to know what your
options are for programming and extending this application?
</p>
<p>The answer to this question varies from one application to another,
because the options available depend inevitably on whether the
application developer has provided any hooks for you to hang your own
code on and, if there are such hooks, what they allow you to
do.<a class="footnote" id="DOCF7" href="#FOOT7"><sup>7</sup></a> For example&hellip;
</p>
<ul class="itemize mark-bullet">
<li>If the application permits you to load and execute any Guile code, the
world is your oyster. You can extend the application in any way that
you choose.
</li><li>A more cautious application might allow you to load and execute Guile
code, but only in a <em class="dfn">safe</em> environment, where the interface
available is restricted by the application from the standard Guile API.
</li><li>Or a really fearful application might not provide a hook to really
execute user code at all, but just use Scheme syntax as a convenient way
for users to specify application data or configuration options.
</li></ul>
<p>In the last two cases, what you can do is, by definition, restricted by
the application, and you should refer to the application&rsquo;s own manual to
find out your options.
</p>
<p>The most well known example of the first case is Emacs, with its
extension language Emacs Lisp: as well as being a text editor, Emacs
supports the loading and execution of arbitrary Emacs Lisp code. The
result of such openness has been dramatic: Emacs now benefits from
user-contributed Emacs Lisp libraries that extend the basic editing
function to do everything from reading news to psychoanalysis and
playing adventure games. The only limitation is that extensions are
restricted to the functionality provided by Emacs&rsquo;s built-in set of
primitive operations. For example, you can interact and display data by
manipulating the contents of an Emacs buffer, but you can&rsquo;t pop-up and
draw a window with a layout that is totally different to the Emacs
standard.
</p>
<p>This situation with a Guile application that supports the loading of
arbitrary user code is similar, except perhaps even more so, because
Guile also supports the loading of extension libraries written in C.
This last point enables user code to add new primitive operations to
Guile, and so to bypass the limitation present in Emacs Lisp.
</p>
<p>At this point, the distinction between an application developer and an
application user becomes rather blurred. Instead of seeing yourself as
a user extending an application, you could equally well say that you are
developing a new application of your own using some of the primitive
functionality provided by the original application. As such, all the
discussions of the preceding sections of this chapter are relevant to
how you can proceed with developing your extension.
</p>
</div>
<div class="footnotes-segment">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>
<h5 class="footnote-body-heading"><a id="FOOT7" href="#DOCF7">(7)</a></h5>
<p>Of course, in the world of free software, you always have
the freedom to modify the application&rsquo;s source code to your own
requirements. Here we are concerned with the extension options that the
application has provided for without your needing to modify its source
code.</p>
</div>
<hr>
<div class="nav-panel">
<p>
Previous: <a href="Programming-Options.html">A Choice of Programming Options</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>