* Avoiding name clashes between different scripts
@ 2005-04-01 10:55 Chusslove Illich
2005-04-01 12:47 ` Thien-Thi Nguyen
0 siblings, 1 reply; 3+ messages in thread
From: Chusslove Illich @ 2005-04-01 10:55 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 2061 bytes --]
Hi folks,
I am trying to introduce Guile for scripting some things within, eh, a
certain C++ application. Some of these scripts, written by different
people, would come bundled with the app, and users could build their
scripts on top.
One (of many :) questions that I haven't been able to resolve yet, is what
mechanism to use to avoid name clashes in top level defines? I would like
to avoid forcing script writers to use unique prefix for defines as in C,
something like namespaces in C++ would be preferable.
Some specialties of the intended use might be helpful:
(1) Distributed scripts can be of arbitrary complexity, but user scripts
would normally be just calls to single functions within distributed
scripts, and in any case no more than few lines of code. In that light, I
wouldn't like heavy syntax for users to use namespace separations.
(2) The app itself can provide a sensible default namespace for each user
script, so ideally users wouldn't have to bother with namespaces at all,
unless they need something from other namespace. But when they do need it,
I'd like that they must name it (no automatic resolution in case of
unambiguous situation).
(3) I wouldn't even mind completely disabling users to use other than
default namespace if that would cut down the syntax in user scripts, since
users and writers of distributed scripts would actually be well connected.
(4) While namespaces would be fine, consider this about just prefixing top
level defines: prefixes could be very well defined (no need for anyone to
think what to use) and consisting of only two to three letters. Together
with (2) and (3), I might settle to a universal single character prefix,
to be replaced by suitable real prefix by the application before user
script is executed.
This was my attempt to shrink the problem to general considerations, but if
you would like the full story, it is here:
http://caslav.gmxhome.de/writings/ktranscript.html
--
Chusslove Illich (Часлав Илић)
[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 140 bytes --]
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Avoiding name clashes between different scripts
2005-04-01 10:55 Avoiding name clashes between different scripts Chusslove Illich
@ 2005-04-01 12:47 ` Thien-Thi Nguyen
2005-04-01 14:57 ` Chusslove Illich
0 siblings, 1 reply; 3+ messages in thread
From: Thien-Thi Nguyen @ 2005-04-01 12:47 UTC (permalink / raw)
Cc: guile-user
From: Chusslove Illich <caslav.ilic@gmx.net>
Date: Fri, 1 Apr 2005 12:55:10 +0200
I am trying to introduce Guile for scripting some things
within, eh, a certain C++ application. [...]
probably you should avoid top-level defines and use "executable
modules", instead:
http://www.glug.org/docbits/guile/1.4.x/Executable-Modules.html
a module gives you a namespace into and out of which you can
import and export bindings. "executable" (in this context)
means the code has a standard interface invokable from the
command line. in this case, your execution environment is not
from the command line, but the techniques involved would be the
same.
thi
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Avoiding name clashes between different scripts
2005-04-01 12:47 ` Thien-Thi Nguyen
@ 2005-04-01 14:57 ` Chusslove Illich
0 siblings, 0 replies; 3+ messages in thread
From: Chusslove Illich @ 2005-04-01 14:57 UTC (permalink / raw)
Cc: guile-user
[-- Attachment #1.1: Type: text/plain, Size: 430 bytes --]
> [: Thien-Thi Nguyen :]
> probably you should avoid top-level defines and use "executable
> modules" [...] a module gives you a namespace into and out of which
> you can import and export bindings.
Oh... I should have read the manual more carefully. Not only that this
perfectly solves what I wanted, but also simplifies some other things that
I had in mind. Thanks :)
--
Chusslove Illich (Часлав Илић)
[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 140 bytes --]
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-04-01 14:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-01 10:55 Avoiding name clashes between different scripts Chusslove Illich
2005-04-01 12:47 ` Thien-Thi Nguyen
2005-04-01 14:57 ` Chusslove Illich
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).