|
|
Up |
|
|
  |
Author: Stephen PelcStephen Pelc Date: Aug 11, 2008 05:56
Well, it's that time of year again, so I'm in proposal mode.
Don't forget to attend EuroForth 2008 and the Forth200x standards
meeting in gorgeous glorious Vienna from 25-28 September 2008.
http://www.euroforth.org
I have separated the enhanced local variable syntax from the
local buffer proposal. The main extension in this proposal
is the separation of initialised local arguments from
uninitialised local values.
Stephen
RfD - Enhanced local variable syntax, v4
====================================
Stephen Pelc - 11 August 2008
20080811 Removed references to local buffers as appropriate.
20070914 Moved local buffers to separate proposal.
20070607 Wordsmithing. Corrected reference implementation.
20060822 Added explanatory text.
Corrected reference implementation.
Updated ambiguous conditions.
|
| Show full article (3.38Kb) |
|
| | 110 Comments |
|
  |
Author: Josh GramsJosh Grams Date: Aug 11, 2008 07:35
Stephen Pelc wrote:
> In the example below, a and b are local arguments, a+b and a*b are
> local values, and arr[ is a 10 byte local buffer.
>
>: foo { a b | a+b a*b -- }
> a b + to a+b
> a b * to a*b
> cr a+b . a*b .
> ;
Looks like you missed this text when removing the local buffer stuff...
--Josh
|
| |
|
| | no comments |
|
  |
Author: Andrew HaleyAndrew Haley Date: Aug 11, 2008 09:10
Stephen Pelc mpeforth.com> wrote:
> The following syntax for local arguments and local values is
> proposed. The sequence:
> { ni1 ni2 ... | lv1 lv2 ... -- o1 o2 ... }
> defines local arguments, local values, and outputs. The local
> arguments are automatically initialised from the data stack on
> entry, the rightmost being taken from the top of the data stack.
> Local arguments and local values can be referenced by name within
> the word during compilation. The output names are dummies to allow
> a complete stack comment to be generated.
> The items between { and | are local arguments.
> The items between | and -- are local values or local buffers.
> The items between -- and } are outputs for formal comments only.
So far, reasonable enough.
> The outputs are provided in the notation so that complete stack
> comments can be produced. However, all text between -- and } is
> ignored. The facility is there to permit the notation to form a
> complete stack comment. This eases documentation and current
> users of the notation like this facility.
|
| Show full article (1.66Kb) |
| no comments |
|
  |
Author: Aleksej SaushevAleksej Saushev Date: Aug 11, 2008 12:41
> Well, it's that time of year again, so I'm in proposal mode.
> Don't forget to attend EuroForth 2008 and the Forth200x standards
> meeting in gorgeous glorious Vienna from 25-28 September 2008.
> http://www.euroforth.org
>
> RfD - Enhanced local variable syntax, v4
> Stephen Pelc - 11 August 2008
...
> Any name ending in the '[' character is reserved for compatibility
> with existing implementations.
I don't like standards, which start from exceptions.
Why is this the only character reserved?
Why don't we reserve other characters from "!@#$%%^&*()[]\~;':<>?,./" set?
Instead of conceptually clear syntax you're making precedent for all sort
of quirks. I strongly object to such attitude to the standard.
It is going to be yet another Perl at this pace.
|
| Show full article (1.00Kb) |
| no comments |
|
  |
Author: Stephen PelcStephen Pelc Date: Aug 11, 2008 15:00
On Mon, 11 Aug 2008 23:41:12 +0400, Aleksej Saushev
wrote:
>> Any name ending in the '[' character is reserved for compatibility
>> with existing implementations.
>
>I don't like standards, which start from exceptions.
>Why is this the only character reserved?
As you quoted
"for compatibility with existing implementations."
To prevent code breakage in VFX Forth systems both hosted and
embedded. MPE has been using the nortation
: foo { a b | c d e[ 5 cells ] f[ 7 cells ] -- }
for local arrays for 15 years or so. I'm not silly enough to
put forward a proposal that will break our own code. See the
local buffers proposal.
The point of this proposal is that it introduces uninitialised
local values as well as local arguments.
|
| Show full article (1.50Kb) |
| no comments |
|
  |
Author: Elizabeth D RatherElizabeth D Rather Date: Aug 11, 2008 15:23
Andrew Haley wrote:
> Stephen Pelc mpeforth.com> wrote:
>> The following syntax for local arguments and local values is
>> proposed. The sequence:
>> { ni1 ni2 ... | lv1 lv2 ... -- o1 o2 ... }
>> defines local arguments, local values, and outputs. The local
>> arguments are automatically initialised from the data stack on
>> entry, the rightmost being taken from the top of the data stack.
>> Local arguments and local values can be referenced by name within
>> the word during compilation. The output names are dummies to allow
>> a complete stack comment to be generated.
>> The items between { and | are local arguments.
>> The items between | and -- are local values or local buffers.
>> The items between -- and } are outputs for formal comments only.
>
> So far, reasonable enough.
>
>> The outputs are provided in the notation so that complete stack
>> comments can be produced. However, all text between -- and } is
>> ignored. The facility is there to permit the notation to form a ...
|
| Show full article (2.34Kb) |
| no comments |
|
  |
Author: Stephen PelcStephen Pelc Date: Aug 11, 2008 15:15
On Mon, 11 Aug 2008 11:10:06 -0500, Andrew Haley
wrote:
>> The outputs are provided in the notation so that complete stack
>> comments can be produced. However, all text between -- and } is
>> ignored. The facility is there to permit the notation to form a
>> complete stack comment. This eases documentation and current
>> users of the notation like this facility.
>
>No, this is vile. Mixing semantically significant code with comments
>in such an arbitrary way is a bad idea: it has no precedent in Forth,
>and it is unnecessarily confusing.
You don't have to do it that way
{ a b | c d }
is legal according to the proposal. There are, believe it or not,
Forth systems out there that use '--' as a comment to end of line.
To rephrase in a reductionist way:
"Mixing semantically significant code with comments
is a bad idea"
So all comments are a bad idea?
|
| Show full article (1.69Kb) |
| no comments |
|
  |
Author: Stephen PelcStephen Pelc Date: Aug 11, 2008 17:19
On Mon, 11 Aug 2008 12:23:35 -1000, Elizabeth D Rather
forth.com> wrote:
>I strongly agree with Andrew. You shouldn't try to mix syntactic
>elements with comments. Among other things, it creates the necessity
>for reserving [ which Alexei deplores, and I do as well.
The [ reservation has *nothing* to do with ignoring the section
between '--' and '}'. The '--' marker is *optional*.
This proposal has existed in VFX Forth and its predecessors for 15+
years and is supported (without the '[' reservation) in Win32Forth
and gforth.
Stephen
--
Stephen Pelc, stephenXXX@ mpeforth.com
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
|
| |
| no comments |
|
  |
Author: Stephen PelcStephen Pelc Date: Aug 11, 2008 17:53
On Mon, 11 Aug 2008 23:41:12 +0400, Aleksej Saushev
wrote:
>Instead of conceptually clear syntax you're making precedent for all sort
>of quirks. I strongly object to such attitude to the standard.
>It is going to be yet another Perl at this pace.
It's a standards proposal. The conceptual clarity comes from
considering the brace notation as a formal comment that mirrors
the conventional stack comment notation:
( a b c -- d e }
This now extended to include local values by adding the '|'
separator and changing the brackets to braces:
{ a b c | x y z -- d e }
Since we permit the data stack and return stack to be manipulated
between the closing '}' and ';' we chose 15+ years ago to ignore
what is between the '--' and the closing brace.
>If you want some characters to be reserved, put your locals library
>into public domain and let it spread. At least we'll see, what is
>actually used in community.
|
| Show full article (2.04Kb) |
| no comments |
|
  |
|
|
  |
Author: Doug HoffmanDoug Hoffman Date: Aug 11, 2008 20:27
Andrew Haley wrote:
>> The outputs are provided in the notation so that complete stack
>> comments can be produced. However, all text between -- and } is
>> ignored. The facility is there to permit the notation to form a
>> complete stack comment. This eases documentation and current
>> users of the notation like this facility.
>
> No, this is vile. Mixing semantically significant code with comments
> in such an arbitrary way is a bad idea: it has no precedent in Forth,
It works just the same as what I've used on two different Forths.
> and it is unnecessarily confusing. I thought that { a b -- c d }
> meant that the contents of the variables after the "--" would be
> automatically returned as the result, but this is not what happens.
Thankfully. That is too much automation, IMHO.
> While this convention may be in use in some systems it isn't suitable
> for standardization.
|
| Show full article (1.69Kb) |
| no comments |
|
|
|
|