Search the web
Sign In
New User? Sign Up
forth200x
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
3rd RfD: Directories   Message List  
Reply | Forward Message #221 of 425 |
Re:3rd RfD: Directories

> This is the third RfD on this topic. The second one was in July
> 2007. You find the updated text further down.

I have two issues outstanding:
1) F" is not a fully reusable tool,
2) Name explosion, e.g. why not FS" for file in a search path.

The first issue is that applications often extract file names
from places other than source code or the command line. They
should be able to use the tools. At present this proposal is
limited to the time frame of compilation from files.
a) What happens if no file is being compiled?
b) is there an implicit idea of a base directory?
c) What happens to the implicit base directory when the file
closes?

The second issue concerns opening the door to (say) FS" which
specifies that the file is included from a search path. However,
many of these actions are better performed by the consumer.

I'm trying to look at this from the perspective of the
application programmer (AP). APs use the shortest and simplest
approach. For example, they don't use INCLUDED unless they have
to - many of them don't know it exists.

Relative to the current file directory is only one special case.
Other common ones are relative to the application source tree,
relative to the Forth tool tree, or relative to some particular
tool's tree.

Rather than use INCLUDE-NAME-ABS as the primitive, I would
suggest
TransFileName \ caddr1 len1 mode -- caddr2 len2
where mode is an opaque type that defines how the name is to be
translated. Note that mode can also be passed in a system-
dependent manner. Let's define mode=0 or some such as the normal
unprocessed state, such that caddr2/len2=caddr1/len1. We can
also state that mode is reset by all consumers, even if they
THROW.

Now we can define a set of triggers:
-FMODE \ -- ; what we have now
RELATIVE \ -- ; relative to current file
SERACHPATH \ -- ; relative to the search path
...

With a suitable primitive, we can then define a relative
include:

variable Fmode \ -- addr ; holds consumption mode

: FINCLUDED \ caddr len --
Fmode @ TransFileName ['] included catch
0 Fmode ! \ or NORMAL
throw
;

Now we have tools that can be used by applications in a layering
to be defined by the implementer, and we do not have to define
multiple new words for every search extension. All we have to do
is to define the time frame of extension triggers and the words
that set them.

Short cuts such as xINCLUDE now reduce to trivial definitions.
If you build this into INCLUDE itself, you get

RELATIVE INCLUDE foo.bar

or you can define
: RINCLUDE RELATIVE INCLUDE ;
: SINCLUDE SEARCHPATH INCLUDE ;

IMHO it is really important to consider application programmers.
They are the people who use what toolmakers produce. Remember
also that Forth is an interactive language and we should make
our primary tools available at run time.

Stephen
--
Stephen Pelc, stephen@...
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads




Wed Aug 6, 2008 12:04 pm

sfprem
Offline Offline
Send Email Send Email

Forward
Message #221 of 425 |
Expand Messages Author Sort by Date

This is the third RfD on this topic. The second one was in July 2007. You find the updated text further down. The main point of contention was about the...
Anton Ertl
anton@...
Send Email
Aug 5, 2008
5:19 pm

... I have two issues outstanding: 1) F" is not a fully reusable tool, 2) Name explosion, e.g. why not FS" for file in a search path. The first issue is that...
Stephen Pelc
sfprem
Offline Send Email
Aug 6, 2008
12:05 pm

... Yes, the scope of this proposal is limited. ... See "What if the user uses F" or INCLUDE-NAME-ABS outside a Forth ... No. ... If you want to create a file...
Anton Ertl
anton@...
Send Email
Aug 7, 2008
9:59 am

... Now I understand what you mean with consumer. You mean words like OPEN-FILE and INCLUDED that consume file names, right? At the start of this proposal I...
Anton Ertl
anton@...
Send Email
Aug 7, 2008
8:43 pm

... You miss the point. These days, file names often come from dialog boxes, databases and so on. The application programmer is presented with a) a filename...
Stephen Pelc
sfprem
Offline Send Email
Aug 7, 2008
12:28 pm

... The dialog boxes I have experienced produce absolute file names, so no relative-directory-handling is necessary. I have never seen a database contain file...
Anton Ertl
anton@...
Send Email
Aug 7, 2008
9:18 pm

... Yes. In practice, the only two that matter are OPEN-FILE and CREATE-FILE. VFX expands text macros there. We have not had a single tech support query about...
Stephen Pelc
sfprem
Offline Send Email
Aug 8, 2008
12:08 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help