Paul Rubin <no.e...@nospam.invalid> writes:
>
an...@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>> At EuroForth Andrew Read gave an impromptu talk where he suggested a
>> next-standard effort that would not be shackled by
>
>Are there any slides or video about this?
IIRC he used the flip chart, but in any case I have no electronic
slides. There may be a video, the videos have not been published yet.
>> the talk got me thinking about what is essential in the current line
>> of Forth standards
>
>I'd be interested in your thoughts about what is essential in the
>current line of Forth standards, and which parts if any of that are NOT
>essential to a (subjective) higher-level concept of what Forth is.
My original posting was an exploration of that. My conclusion is that
the lines are not as clearly drawn as I thought before:
For the standard, the issue is not so much what is essential, but
what finds consensus, and how long it takes and how much work it takes
to change it. In theory, we could move almost everywhere. In
practice, we hardly move at all.
But does that mean there should be a "next-standard" effort that goes
where it is too hard to reach with the current standards effort? I
have my doubts that there will be consensus on such a next standard.
How much commonality is there among systems that do not follow the
standard? And would the implementors of these systems really be
interested in finding consensus on a next standard?
I think that a Turbo-Pascal like effect is more likely: While the
Pascal standard was pretty limited, and it took until 1990 to publish
the "Extended Pascal" standard, Turbo Pascal added all the features
its designers considered useful, without letting themselves be
shackled by the Pascal standard, and became the dominant Pascal
implementation in terms of percentage of written code and installed
systems, making the Pascal standards irrelevant. So, if a Forth
system manages to grab a large percentage of the Forth market, that
would be the "next standard".
Which parts of the standard are not essential? Lots; machine Forth is
a Forth, and it has little in common with the standard. I did not
consider systems with any form of type checking to be "Forth" before
starting this thread, but now this does not seem so clear-cut to me.
>> Possibly essential: The syntax difference between machine Forth and
>> Color Forth (color that indicates how to text-interpret the string)
>> cannot be accommodated in the current line of standards; while it's
>> just syntax ...
>
>Is it really just syntax? I don't really understand how Colorforth
>works but I gather that it separates "edit time" from "compile time"
>much more than traditional or ANS Forth does.
Yes, I dimly remember something along these lines; I am not sure that
that really makes a fundamental difference.
By contrast, I found Holon/HolonForth's approach does take away some
features that I consider fundamental in Forth, while also providing
cool features (Wolf Wejgaard gave a nice presentation at EuroForth).
In Holon the dictionary is constructed at edit time, and the source
code and executable code hangs from the dictionary, which is
browsable.
An important (IMO) Forth feature Holon takes away is the ability to
create words at run-time.
>> Pretty essential: Statically determined stack depth: Requiring that,
>> as sketched for PAF,
>
>At that point maybe you want to depart from Forth tradition and have
>named stack slots (ouch!).
Actually Glass [glass83] proposed this 30 years ago, and it has a
certain cuteness, but I don't see any benefits over removing them from
the data stack. For PAF, for which both stack items and locals are
just pseudo-registers, there is little difference, and for the
programmer, it means that he has a hard time accessing stack items
lower on the stack than the locals.
@InCollection{glass83,
author = "Harvey Glass",
title = "Towards a More Writable {Forth} Syntax",
crossref = "ouverson86",
chapter = "21",
pages = "169--181",
note = "Reprinted from {\em Proceedings of the 1983 Rochester
Forth Applications Conference}"
}
@Book{ouverson86,
booktitle = {Dr.\ Dobb's Toolbook of Forth},
publisher = {M\&T Books},
year = {1986},
editor = {Marlin Ouverson},
address = {Redwood City, CA 94063}
}
>I do think dynamic stack effects (while
>misused sometimes) have valid uses, like variable sized arg lists, e.g.
>
> : foo ( a1 a2 .. an n -- ) ... \ n is # of args
>
>Most languages have some mechanism for that, such as varargs in C etc.
And they cause complications and external costs in the calling
convention.
There are uses for that kind of stuff, but they are rare and can be
avoided without too much effort. If avoiding it did cost too much, I
would add the common patterns to PAF; basically a sequence like
"a1...an n" would be treated as one stack item, allowing the rest of
the stack to be handled statically.
>Also, do you want for conforming implementations to actually enforce
>this rule? Overall it sounds like a difficult sell even though PAF and
>other compilers would benefit from it.
A PAF-only compiler should produce an error message on such code,
because it cannot produce the machine code that does what the
programmer expects. If a compiler is extended from PAF to Forth, it
would generate code that does what the programmer expects, and such a
compiler would either produce a warning (in PAF mode) or be quiet (in
Forth mode) when encountering such code.
It may be a hard sell to Forth programmers (not very hard, though,
IMO), but the idea of PAF is not as a replacement for Forth, but as an
intermediate language for compilers; and the compiler writers will not
find it at all hard to comply with these restrictions; the hard sell
to them will be to sell them a Forth-like language.
>> Static type checking: StrongForth did that
>
>This also seems like a hard sell, since StrongForth didn't get much
>traction. It also sounds harder to implement than traditional Forth.
>Do you really think of it as essential?
Obviously not, or I would have worked on it more, and maybe used
StrongForth.
The question was if the "weak"ness of standard Forth is essential.
Before to original posting, I thought so, but, depending on the type
system, this is just a step further in the Forth->PAF progression.
The problem is actually defining a type system that catches most/all
of the things that Forth programmers consider a type error, but does
not or only rarely annoys programmers with false positives. It may be
an issue of the programmer and the type system getting used to each
other (the Stockholm syndrome seems to be very common in these kinds
of situations).
>> Floats: There is one suggestion (and a Russion system that works this
>> way) to use floats as stack items, with words like + working on
>> floats, and IIRC addresses represented by NaNs (or maybe by
>> interpreting the bit pattern as address).
>
>No please don't do that ;-). It's one of the fail points of Javascript
>and older versions of Lua and maybe others as well.
Lua went away from that? Interesting. What's the story behind that?
>> Dynamically typed stack items (e.g., Factor, 8th, Oforth,...)
>
>I wonder how many users of those systems actually started out as Forth
>users.
Does it matter? If these systems attract new users to the family of
Forth-like languages, is that bad?
>Another idea is to have a standard Forth with pseudo-static typing:
>i.e., have a testing/debugging mode where every cell is accompanied by a
>tag field that's checked at runtime, signalling errors that might
>otherwise be missed. Then once debugged, you can turn off the checks.
>No idea how useful this is.
Again, you need a type system, but this one might be easier than a
statically checkable one.
>Meanwhile some other imho essentials missing from your list: 1) design
>changes to accomodate processors with flash program storage,
Does not appear too hard to me and reachable within the standard
framework, at least in theory. In practice people who used to
complain about the problems CREATE DOES> causes in this regard have
apparently given up or are content to have found workarounds for the
problems.
> 2) changes
>to accomodate cross-compilation
I think that cross-compilation and the hard compilation/run-time
boundary it requires destroys an essential property of Forth, but
that's a minority position. Anyway, many systems have some form of
cross compilation, but there does not seem to be consensus on a common
approach. And apparently there is still enough movement in this area
that the existing cross-compilation proposal is now deemed outdated by
its proponents, and dropped from the standardization effort.