Re: Language module support added
Bram Moolenaar <[email protected]>
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
Adriaan de Groot wrote:
> On Thu, 25 Sep 2003, Bram Moolenaar wrote:
> > - The ":import" command (implemented by Adriaan de Groot).
>
> Coo, thnax.
>
> > - The ":import" command searches various "modules" directories for a
> > module. All found modules are loaded in the same scope. The modules
> > must take care of not defining things that have already been done by
> > checking for the did_import_<name> variable.
>
> OK, excellent. I already had some coverage for that in the code, why do
> you want to place the burden on the module writers? Is it because the
> file-has-been-read data stores absolute filenames?
I implemented this like the way Vim loads plugins. I have not given it
more thought yet.
> I haven't looked at the code yet, but is there overlap between the
> modules dirs and the directories that are scanned for .aap files on
> startup? that you make either the modules or the dir scan superfluous,
> i think.
The "startup" directory is scanned during startup. A system
administrator and/or user can use this for his default settings,
filetype detection, etc.
The "modules" directory is used for modules that are loaded with
":import". Thus these are only loaded in specific recipes. This avoids
a long startup time and problems with conflicting languages.
If we want to avoid the use of "did_import_<name>" in module recipes, we
could do it slightly different:
1. Aap looks in the system "modules" directory. If the module is found
there go to step 4.
2. Aap looks in the user "~/.aap/modules" directory. If the module is
found there go to step 4.
3. Aap looks in the installed "modules" directory.
4. If the module is not found, give an error message (and quit)
5. Look for additional settings in the system "modules2" directory.
6. Look for additional settings in the user "~/.aap/modules2" directory.
This still allows a user to add a few things after a module was loaded.
My experience with Vim is that this is required to avoid that the user
has to copy a module to make his small changes (and repeat that for
every release).
> > - I named the "d" module "dlang", to avoid a name conflict with a
> > variable called "d". There can't be a variable and a scope with the
> > same name.
>
> Could you do some magic to prevent that overlap? I rather liked the m_d
> scope name or _module_d.
Prepending something is easy. The question is what is a simple and
clear scope name that is unlikely to conflict with variable names?
I do prefer to keep the module names simple, thus "dlang" is not as good
as "d". What names could we use?
:import with "lang" with "m_" with "_module_"
pascal pascallang m_pascal _module_pascal
java javalang m_java _module_java
d dlang m_d _module_d
I would prefer using "m_". Does someone have a better idea?
> > Hopefully I didn't break the already working code that others made.
> > Please let me know what should be improved!
>
> I'll take a stab at it tomorrow.
I'll try to add documenation today.
--
Now it is such a bizarrely improbable coincidence that anything as
mind-bogglingly useful as the Babel fish could have evolved purely by chance
that some thinkers have chosen to see it as a final and clinching proof of the
NON-existence of God.
The argument goes something like this: 'I refuse to prove that I exist,' says
God, 'for proof denies faith, and without faith I am nothing.'
'But,' says Man, 'the Babel fish is a dead giveaway, isn't it? It could not
have evolved by chance. It proves you exist, and so therefore, by your own
arguments, you don't. QED.'
'Oh dear,' says God, 'I hadn't thought of that,' and promptly vanishes in a
puff of logic.
'Oh, that was easy,' says Man, and for an encore goes on to prove that black
is white and gets himself killed on the next pedestrian crossing.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf