Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: Type checki...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 40 of 71 Topic 3977 of 4053
Post > Topic >>

Re: Type checking (was: The strengths of FORTH)

by "Stephan Becher" <stephan.remove-this.becher@[EMAIL PROTECTED] > Apr 9, 2008 at 08:49 AM

"Bruce McFarling" <agila61@[EMAIL PROTECTED]
> schrieb im Newsbeitrag 
news:46265d52-578e-42dc-8731-c17dca1745c1@[EMAIL PROTECTED]
> On Apr 8, 2:01 am, "Stephan Becher" <stephan.remove-this.bec...@[EMAIL PROTECTED]
> online.de> wrote:
>> "Bernd Paysan" <bernd.pay...@[EMAIL PROTECTED]
> schrieb im 
>> Newsbeitragnews:guupc5-i8q.ln1@[EMAIL PROTECTED]
>> ...
>>
>> > Having a library for StrongForth would probably reduce some comments 
>> > from
>> > non-Forthers like Q: "you don't have typechecking" A: "require 
>> > strong.fs"
>
>> That would really be nice, but I'm afraid it's not doable. As Michael 
>> wrote,
>> StrongForth is "inherently unstandard". Strong static type checking
works
>> only if the compiler has precise information about the stack effect of 
>> each
>> word.
>
>> In StrongForth, this information is included in the dictionary. But it
>> would be difficult to add this information to a system that does not 
>> provide
>> it from the start.
>
> Yes, strong.fs would probably need a data file for the specific
> implementation is is loading into. But if five or six implementations
> covers 90%+ of installations, that's not a big obstacle.
>
> "What can be written in vanilla portable Forth-94" is an interesting
> intellectual exercise, but "what can be written in portable Forth-94
> with a manageable portability harness" is a more sensible exercise if
> the aim is to produce a useful library.
>
>> Even if this was possible, how to deal with a
>> non-typechecking library that is included after "strong.fs"?
>
> I think that this could not be done by including any words in FORTH-
> WORDLIST other than the word to launch into the StrongForth namespace.
>
> IOW, yt would require building a "StrongForth" wordlist and then
> making it the bottom wordlist in the stack when "StrongForth" is
> executed, and when "Forth" is executed inside StrongForth, it does not
> ADD Forth to the StrongForth wordlist stack ... it *replaces*
> StrongForth.
>
> If a non-type-checking library is called, it has to have words in it
> that can have type-checked outputs, given type-checked inputs,
> otherwise its not a useful library for working from inside the
> StrongForth namespace. So it would require a prelude file that would
> load the non-type-checking library, then import into StrongForth the
> desired word with the type-checking binding.
>
>> Furthermore, some words like ?DUP and FIND are simply incompatible with
>> strong static type checking, because their stack effects are not known
at
>> compile time.
>
> ?DUP and FIND would not be in the StrongForth namespace.
>
>> And finally, "strong.fs" couldn't take advantage of
>> overloading, because this feature introduces hundreds of additional
>> incompatibilities by changing the names of many words.
>
> Again, the documentation of strong.fs would not claim that a Forth-94
> system existed after
>
> REQUIRE strong.fs
> StrongForth
>
> A strongly-typed Forth-94 *cannot be done*. So if someone insists on a
> "strongly-typed Forth", they are not losing anything they are not
> prepared to lose in having to work with a non-Forth-94 system. If 85%
> compatible as as close as it can get, offer them an 85% compatible
> strongly typed language written for widely available Forth-94
> implementations.

Okay. Let me summarize how I interpret your (and Bernd's and Jonah's) 
suggestions.

strong.fs is actually an implementation of StrongForth in Forth-94. After 
loading strong.fs you can switch to the StrongForth system, which has its 
own compiler and its own dictionary. The StrongForth compiler and 
interpreter cannot directly access the Forth-94 dictionary, because the 
words in this dictionary do not contain type information. However, it is 
possible to define a new StrongForth word with type information etc. as an

alias (or wrapper) of a word defined in the Forth-94 dictionary. This
would 
grant the StrongForth system access to Forth-94 libraries and word sets.

strong.fs would consist of two parts:

The first part will be 100% Forth-94 code. It will implement StrongForth's

kernel, plus a word that switches from the Forth-94 system to StrongForth.

At the end of the first part, this word is being executed.

The second part will run StrongForth. It will compile StrongForth 
definitions as aliases (wrappers) of existing Forth-94 words, provided
these 
words have unambiguous stack diagrams. Furthermore, additional pure 
StrongForth words that have no counterpart in Forth-94 can be defined as 
required to complete the StrongForth word sets. At the end of the second 
part, the system could optionally switch back to the Forth-94 system.

It should be possible to switch between the two systems. Additional
Forth-94 
libraries can be included by compiling them with the Forth-94 compiler. To

make them available in StrongForth, one has to switch to StrongForth and 
compile an alias (wrapper) for each word in the library.

The important point is that two compilers and two dictionaries exist in 
parallel. It is not possible to mix the two systems, e. g., by executing
or 
compiling a StrongForth word with the Forth-94 compiler or vice versa. But

that's not necessary anyway. The main advantages are that StrongForth with

its type checking and overloading features can actually run on each
Forth-94 
system, and that all existing Forth-94 libraries can easily be made 
available to StrongForth.

This apporach sounds doable, so I will give it some more thoughts. The 
implementation effort doesn't seem too high, because StrongForth's kernel
is 
rather small.

Stephan




 71 Posts in Topic:
The strengths of FORTH
"Robert Miller"  2008-03-27 15:01:14 
Re: The strengths of FORTH
Jonah Thomas <jethomas  2008-03-27 18:47:44 
Re: The strengths of FORTH
Bruce McFarling <agila  2008-03-27 18:46:42 
Re: The strengths of FORTH
Bruce McFarling <agila  2008-03-28 09:30:44 
Re: The strengths of FORTH
mhx@[EMAIL PROTECTED] (M  2008-03-28 19:21:30 
Re: The strengths of FORTH
Bruce McFarling <agila  2008-03-28 12:06:51 
Re: The strengths of FORTH
"Paul E. Bennett&quo  2008-03-27 23:21:10 
Re: The strengths of FORTH
Brad Eckert <nospaambr  2008-03-27 19:03:48 
Re: The strengths of FORTH
Jonah Thomas <jethomas  2008-03-27 22:15:25 
Re: The strengths of FORTH
Benny Andersen <a.mail  2008-03-28 09:59:05 
Re: The strengths of FORTH
"dkelvey@[EMAIL PROT  2008-03-28 07:50:09 
Re: The strengths of FORTH
John Doty <jpd@[EMAIL   2008-03-28 09:25:07 
Type checking (was: The strengths of FORTH)
anton@[EMAIL PROTECTED]   2008-03-28 20:33:46 
Re: The strengths of FORTH
Bruce McFarling <agila  2008-03-28 09:42:22 
Re: The strengths of FORTH
Reinhold Straub <demar  2008-03-29 04:48:43 
Re: The strengths of FORTH
William James <w_a_x_m  2008-03-29 12:00:12 
Re: The strengths of FORTH
Reinhold Straub <demar  2008-03-30 05:59:03 
Re: Type checking (was: The strengths of FORTH)
m_l_g3@[EMAIL PROTECTED]   2008-04-02 01:04:50 
Re: Type checking (was: The strengths of FORTH)
"Stephan Becher"  2008-04-07 09:46:32 
Re: Type checking
"David N. Williams&q  2008-04-07 12:20:20 
Re: Type checking
"Stephan Becher"  2008-04-07 17:30:08 
Re: Type checking (was: The strengths of FORTH)
Trey Boudreau <trey@[E  2008-04-07 10:07:45 
Re: Type checking (was: The strengths of FORTH)
Bernd Paysan <bernd.pa  2008-04-07 18:32:48 
Re: Type checking (was: The strengths of FORTH)
Trey Boudreau <trey@[E  2008-04-07 16:46:00 
Re: Type checking (was: The strengths of FORTH)
"Stephan Becher"  2008-04-08 08:01:23 
Re: Type checking (was: The strengths of FORTH)
Bernd Paysan <bernd.pa  2008-04-08 10:16:55 
Re: Type checking (was: The strengths of FORTH)
kenney@[EMAIL PROTECTED]   2008-04-09 06:17:26 
Re: Type checking (was: The strengths of FORTH)
Bruce McFarling <agila  2008-04-09 07:39:32 
Re: Type checking (was: The strengths of FORTH)
"Mark W. Humphries&q  2008-04-09 09:08:39 
Re: Type checking (was: The strengths of FORTH)
Bernd Paysan <bernd.pa  2008-04-09 18:26:48 
Re: Type checking (was: The strengths of FORTH)
Doug Hoffman <no.spam&  2008-04-09 17:07:45 
Re: Type checking (was: The strengths of FORTH)
Albert van der Horst <  2008-04-10 03:49:42 
Re: Type checking (was: The strengths of FORTH)
Doug Hoffman <no.spam&  2008-04-10 06:01:45 
Re: Type checking (was: The strengths of FORTH)
Albert van der Horst <  2008-04-10 21:47:04 
Re: Type checking (was: The strengths of FORTH)
Bruce McFarling <agila  2008-04-09 09:19:33 
Re: Type checking (was: The strengths of FORTH)
John Doty <jpd@[EMAIL   2008-05-01 21:35:15 
Re: Type checking (was: The strengths of FORTH)
m_l_g3 <m_l_g3@[EMAIL   2008-04-17 17:27:21 
Re: Type checking (was: The strengths of FORTH)
anton@[EMAIL PROTECTED]   2008-04-08 14:14:30 
Re: Type checking (was: The strengths of FORTH)
Bruce McFarling <agila  2008-04-08 07:18:34 
Re: Type checking (was: The strengths of FORTH)
"Stephan Becher"  2008-04-09 08:49:44 
Re: Type checking (was: The strengths of FORTH)
Bruce McFarling <agila  2008-04-08 07:29:56 
Re: Type checking (was: The strengths of FORTH)
Bruce McFarling <agila  2008-04-09 07:37:06 
Re: Type checking (was: The strengths of FORTH)
"Stephan Becher"  2008-04-10 08:04:57 
Re: Type checking (was: The strengths of FORTH)
m_l_g3 <m_l_g3@[EMAIL   2008-04-09 17:48:14 
Re: Type checking (was: The strengths of FORTH)
"Stephan Becher"  2008-04-10 07:54:14 
Re: Type checking (was: The strengths of FORTH)
Albert van der Horst <  2008-04-10 21:27:21 
Re: Type checking (was: The strengths of FORTH)
Bruce McFarling <agila  2008-04-10 03:30:01 
Re: Type checking (was: The strengths of FORTH)
m_l_g3 <m_l_g3@[EMAIL   2008-04-10 04:16:59 
Re: Type checking (was: The strengths of FORTH)
"Stephan Becher"  2008-04-10 18:53:37 
Re: Type checking (was: The strengths of FORTH)
m_l_g3 <m_l_g3@[EMAIL   2008-04-10 04:48:57 
Re: Type checking (was: The strengths of FORTH)
m_l_g3 <m_l_g3@[EMAIL   2008-04-11 05:02:01 
Re: Type checking (was: The strengths of FORTH)
Bruce McFarling <agila  2008-04-11 08:37:46 
Re: The strengths of FORTH
Mikael Nordman <oh2aun  2008-03-28 19:41:15 
Re: The strengths of FORTH
Albert van der Horst <  2008-03-28 22:26:26 
Re: The strengths of FORTH
"Robert Miller"  2008-03-29 00:19:04 
Re: The strengths of FORTH
Mikael Nordman <oh2aun  2008-03-29 09:56:25 
Re: The strengths of FORTH
Aleksej Saushev <asau@  2008-04-01 23:35:18 
Re: The strengths of FORTH
Mikael Nordman <oh2aun  2008-04-02 18:39:30 
Re: The strengths of FORTH
Aleksej Saushev <asau@  2008-04-06 18:48:28 
Re: The strengths of FORTH
Brad Eckert <nospaambr  2008-04-04 09:29:12 
Re: The strengths of FORTH / OT: SMT soldering
"Robert Miller"  2008-04-04 15:28:47 
Re: The strengths of FORTH / OT: SMT soldering
John Doty <jpd@[EMAIL   2008-04-04 13:51:24 
Re: The strengths of FORTH / OT: SMT soldering
Brad Eckert <nospaambr  2008-04-04 16:46:08 
Re: The strengths of FORTH
William James <w_a_x_m  2008-03-29 11:42:17 
Re: The strengths of FORTH
"Robert Miller"  2008-03-29 17:56:46 
Re: The strengths of FORTH
Andrew Haley <andrew29  2008-03-30 10:03:42 
Re: The strengths of FORTH
Albert van der Horst <  2008-03-30 15:10:11 
Re: The strengths of FORTH
Guy Macon <http://www.  2008-03-30 09:54:09 
Re: The strengths of FORTH
Jonah Thomas <jethomas  2008-03-30 09:59:30 
Re: The strengths of FORTH / OT: SMT soldering
spam@[EMAIL PROTECTED]   2008-04-05 13:49:18 
Re: Type checking (was: The strengths of FORTH)
Jonah Thomas <jethomas  2008-04-08 07:22:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri May 16 2:02:09 CDT 2008.