[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Avoiding name clashes between different scripts

From: Chusslove Illich
Subject: Avoiding name clashes between different scripts
Date: Fri, 1 Apr 2005 12:55:10 +0200
User-agent: KMail/1.7.1

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:

Chusslove Illich (Часлав Илић)

Attachment: pgpDln8kxaJQb.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]