|
|
Up |
|
|
  |
Author: Krishna MyneniKrishna Myneni Date: Mar 10, 2008 21:56
I believe Charles Montgomery first suggested he would like to see this change,
in a previous email to me. I'd like to reintroduce this idea here in c.l.f. for
input from other users of the FSL. Are there any potential pitfalls?
Reorganize the FSL auxiliary files by moving the following words from dynmem.x
to fsl-util.x:
malloc-fail?
cell_size
}malloc
}free
}}malloc
}}free
Then, dynmem.x will only contain ANS compatible definitions of ALLOCATE and
FREE, and associated data structures to support these definitions.
The auxiliary file fsl-util.x should correspondingly be modified to perform a
conditional include of dynmem.x, based on the value of the constant
HAS-MEMORY-WORDS?. Thus, the fsl-util.x file will have the following
HAS-MEMORY-WORDS? [IF] include dynmem.x [THEN]
\ or
HAS-MEMORY-WORDS? [IF] s" dynmem.x" included [THEN]
|
| Show full article (1.34Kb) |
|
| | 20 Comments |
|
  |
Author: Marcel HendrixMarcel Hendrix Date: Mar 10, 2008 22:00
Krishna Myneni bellsouth.net> writes Re: FSL auxiliary files: proposed reorganization of words
[..]
> Then, dynmem.x will only contain ANS compatible definitions of ALLOCATE and
> FREE, and associated data structures to support these definitions.
AFAIK, (and I checked this recently), SwiftForth, VFX and iForth have always
done it like this.
> The auxiliary file fsl-util.x should correspondingly be modified to perform a
> conditional include of dynmem.x, based on the value of the constant
> HAS-MEMORY-WORDS?. Thus, the fsl-util.x file will have the following
> HAS-MEMORY-WORDS? [IF] include dynmem.x [THEN]
Wouldn't that be
HAS-MEMORY-WORDS? 0= [IF] S" dynmem.x" INCLUDED [THEN]
> The above reorganization appears to me a more logical grouping of words in the
> auxiliary files, and will remove the need to include dynmem.x on those Forth
> systems which support ALLOCATE and FREE. Also, for those Forth systems which
> don't have ALLOCATE and FREE, the dynmem.x module becomes more generic and can
> be used in contexts outside of the FSL without the extra baggage.
|
| Show full article (1.56Kb) |
|
| | no comments |
|
  |
Author: Krishna MyneniKrishna Myneni Date: Mar 11, 2008 05:52
Marcel Hendrix wrote:
> Krishna Myneni bellsouth.net> writes Re: FSL auxiliary files: proposed reorganization of words
> [..]
>> Then, dynmem.x will only contain ANS compatible definitions of ALLOCATE and
>> FREE, and associated data structures to support these definitions.
>
> AFAIK, (and I checked this recently), SwiftForth, VFX and iForth have always
> done it like this.
|
| Show full article (2.64Kb) |
| no comments |
|
  |
Author: C. G. MontgomeryC. G. Montgomery Date: Mar 11, 2008 18:12
If I may, I'll join this thread in a less than polite way, by not quoting
specifically from the useful things said in the previous posts, but
making a few comments, some directly related and some indirectly.
1. Moving the dynamic allocation words into fsl-util.whatever makes a lot
of sense. I would even be willing to go through all the library routines
to see whether any would require changes if this were done. But if I,
and VFX, and SwiftForth, and iForth, and most other users of the Library
have already done it, it's not clear that the effort would be justified.
2. There would be a similar benefit, IMHO, in removing the
structure-related words from the general utility files. They are not
needed for many of the library routines, and a separate file could
provide support for routines needing them. This would require more
reworking of more files, though. Since the Forth200x project is taking
up standard structure words, my inclination is to wait for the outcome
there, which might then be incorporated in FSL usage.
|
| Show full article (2.38Kb) |
| no comments |
|
  |
Author: Krishna MyneniKrishna Myneni Date: Mar 11, 2008 20:44
C. G. Montgomery wrote:
> If I may, I'll join this thread in a less than polite way, by not quoting
> specifically from the useful things said in the previous posts, but
> making a few comments, some directly related and some indirectly.
>
> 1. Moving the dynamic allocation words into fsl-util.whatever makes a lot
> of sense. I would even be willing to go through all the library routines
> to see whether any would require changes if this were done. But if I,
> and VFX, and SwiftForth, and iForth, and most other users of the Library
> have already done it, it's not clear that the effort would be justified.
>
The fsl-util.x files for F-PC, ThisForth, PFE, and GFORTH, which are given at
the FSL website, do not have the proposed integration of the dynamic memory
words. They rely on dynmem.x to provide "}malloc" etc.
The fsl-util.x file for Win32Forth, from the FSL website, does integrate
"}malloc" etc. (but I notice there is still a bug in this particular file's
definition of "}}free").
|
| Show full article (3.79Kb) |
| no comments |
|
  |
Author: C. G. MontgomeryC. G. Montgomery Date: Mar 12, 2008 06:30
> C. G. Montgomery wrote:
> (...)
>> (...)
>> 3. A fundamental problem with the utility files, and the FSL in
>> general, is that there is not a good separation between the support
>> needed by the
>...
|
| Show full article (2.74Kb) |
| 7 Comments |
|
  |
Author: Bruce McFarlingBruce McFarling Date: Mar 12, 2008 09:32
On Mar 11, 11:44 pm, Krishna Myneni bellsouth.net>
wrote:
> Just as with the complex number data structure specification, it would be highly
> desirable to fix this particular specification of the result produced by
> invoking an array name. This would permit low-level manipulation of arrays,
> rather than having to specify a fixed API for every conceivable array operation.
You mean, as a standard of the FSL itself, as split stacks are a
standard of the FSL?
No, certainly not.
Rather, it is highly desirable to fix this particular specification of
the result produced by invoking an array name, document it, provide a
standard name for that specification and if you want provide a
tutorial on how to manipulate the result returned by array name words
that follow that particular specification.
Then that standard name for that implementation of the semantics can
appear as a TRUE constant with the same scope as }} and }.
If another wordlist is available that uses a different specification,
in the scope of its definitions for }} and } it defines that standard
name as a FALSE constant.
|
| Show full article (2.91Kb) |
| no comments |
|
  |
Author: C. G. MontgomeryC. G. Montgomery Date: Mar 12, 2008 11:18
> C. G. Montgomery wrote:
>> (...)
> (...)
>> 4. (...)
>> (What we don't have now is a clear specification of just what a
>> fsl-util file needs to provide.)
>
> A fairly clear specification can be produced from the functionality
> provided by the existing fsl-util.x file(s).
>
Except that the different fsl-util files don't all provide the same
functionality. This is something I'm working on (but not my top
priority). Even which words are provided varies. At least some
improvement should be possible without too much trouble. But there is no
definitive list of which words are available to the coder of an
algorithm, let alone a specification of their behavior.
|
| Show full article (0.99Kb) |
| no comments |
|
  |
Author: Marcel HendrixMarcel Hendrix Date: Mar 12, 2008 10:52
"C. G. Montgomery" physics.utoledo.edu> writes Re: FSL auxiliary files: proposed reorganization of words
[..]
> The problem is that creating an array requires storing more than just the
> array contents -- at least information about the size of an element, the
> array shape if there is more than a single dimension, and quite possibly
> more. What additional information is stored, and where and in what form,
> could well vary with the implementation. Then the eventual resolution of
> the address of a particular element must make use of that information. I
> don't like the idea that the FSL should impose restrictions on how this
> is done.
a{{ ( -- id ) \ The meaning of id is implementation-defined.
> (Similarly, the layout of the data should IMHO be flexible --
> row-major order?, column-major order?, code space?, data space?,
> linked-list???)
|
| Show full article (2.66Kb) |
| no comments |
|
  |
|
|
  |
Author: Krishna MyneniKrishna Myneni Date: Mar 13, 2008 02:15
Marcel Hendrix wrote:
> "C. G. Montgomery" physics.utoledo.edu> writes Re: FSL auxiliary files: proposed reorganization of words
> [..]
>> If the result of invoking the name of an array has to be the same in all
>> implementations, I think the only possibility would be that it returns
>> the address of the first array element, but that could force inefficiency
>> for some implementations.
>
> That is not possible for dynamically allocated arrays.
>
How about the following specification for the result of invoking the
array/matrix name?
a{{ ( -- addr )
Return the address to the first array element for statically-defined
arrays/matrices and for dynamic arrays/matrices which have been allocated. For
dynamic arrays/matrices which have not been allocated, the value of addr is
ambiguous.
>> ... (Similarly, the layout of the data should IMHO be flexible --
>> row-major order?, column-major order?, code space?, data space?,
>> linked-list???)
>
> No, please! Rigidly specify row or column...
|
| Show full article (2.95Kb) |
| no comments |
|
|
|
|