Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #52288

Re: 1 /STRING vs SNIP

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: 1 /STRING vs SNIP
Date 2016-10-29 16:44 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2016Oct29.184434@mips.complang.tuwien.ac.at> (permalink)
References (5 earlier) <580b4d3a.724229665@news.eternal-september.org> <2016Oct22.154921@mips.complang.tuwien.ac.at> <nujjrn$579$1@gioia.aioe.org> <2016Oct24.131526@mips.complang.tuwien.ac.at> <nv0ps1$tte$1@gioia.aioe.org>

Show all headers | View raw


"HAA" <someone@microsoft.com> writes:
>Anton Ertl wrote:
>> "HAA" <someone@microsoft.com> writes:
>> >Anton Ertl wrote:
>> >> And at the last meeting we standardized "1 chars = 1".  So if the
>> >> address unit is a byte, /STRING works on bytes.
>> ...
>> >That option already existed under Forth-94.
>>
>> Yes, it was an option, and all popular systems implemented this
>> option, and many programs rely on it.  I.e., it is common practice,
>> and that's why we standardized it.
>
>No.  It may be a fact that on most systems "1 chars = 1" but that doesn't
>give carte blanche to programmers to write 'standard programs' in a
>manner that disregards datatype.

Certainly these programs were not standard programs; they could be
labeled as "standard programs with an environmental dependency on 1
chars = 1".  With the next standard, these programs will be standard
programs.

>ANS was explicit that certain functions
>should handle characters, while others cells, address units and so on.

Yes.  And it turned out that differentiating between chars and address
units was a freedom for systems that no widely-used system exploited;
and on the program side, most programmers chose to ignore this
theoretical difference.  But even those that did not cannot be sure
that their program does not have that environmental dependency (in
Forth-94 and -2012), because they have no way to test their programs
on a system that does not satisfy the environmental dependency.

>A 'Standard Forth Program' is meant to be professional and readable as
>well as portable.  ANS went to pains to get Forth programmers to write code
>that is clear, consistent and informative.

I don't see any particular move in Forth-94 towards requiring
additional words for informative purposes only.

The introduction of CHARS and CHAR+ did not happen for informative
purposes, but for abstracting the character size in the same way that
CELLS and CELL+ abstracts cell size (which became necessary due to the
move from 16-bit systems towards larger cell sizes).  The reasons why
they thought that we would need to abstract the character size were:

1) Nybble-addressed machines, where 8-bit chars would take 2 aus.

2) Unicode, which around 1990 looked to be a 2-byte fixed-width
character set (UCS-2).

However, looking at it 22 years later, no Forth-94 implementation for
nybble-addressed machines is known to me, and it's unlikely that we
will ever see one for the next standard; and it turned out that UCS-2
is not good enough for Unicode, that we can work with Unicode nicely
using 8-bit units, and as a result, the move towards wider chars that
was the reason for introducing CHARS and CHAR+ has not happened in
Forth systems.

Anyway, if you feel the need to use these unnecessary abstractions in
your programs, they are still there, and nobody has proposed removing
them, so you are free to use these words to write what you consider
professional, readable, clear, consistent and informative code.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2016: http://www.euroforth.org/ef16/

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

1 /STRING vs SNIP foxaudioresearch@gmail.com - 2016-10-18 19:31 -0700
  Re: 1 /STRING vs SNIP Ron Aaron <rambamist@gmail.com> - 2016-10-19 07:24 +0300
  Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-19 07:52 +0000
    Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-19 16:58 -0700
      Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-21 16:01 +1000
        Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-21 00:51 -0700
          Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-21 00:57 -0700
        Re: 1 /STRING vs SNIP trans <transfire@gmail.com> - 2016-10-21 05:20 -0700
          Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-22 00:25 +1000
            Re: 1 /STRING vs SNIP trans <transfire@gmail.com> - 2016-10-21 09:13 -0700
              Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-21 16:24 +0000
                Re: 1 /STRING vs SNIP albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-21 20:06 +0200
                Re: 1 /STRING vs SNIP trans <transfire@gmail.com> - 2016-10-21 14:19 -0700
                Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-22 13:46 +1000
                Re: 1 /STRING vs SNIP stephen@mpeforth.com (Stephen Pelc) - 2016-10-22 11:34 +0000
                Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-22 13:49 +0000
                Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-24 11:15 +1000
                Re: 1 /STRING vs SNIP albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-24 03:01 +0200
                Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-24 13:29 +1000
                Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-24 11:15 +0000
                Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-24 19:44 -0700
                Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-29 11:17 +1000
                Re: 1 /STRING vs SNIP Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-10-29 04:09 -0500
                Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-29 16:44 +0000
                Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-29 17:11 -0700
                Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-31 19:11 +1100
                Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-31 08:47 +0000
      Re: 1 /STRING vs SNIP trans <transfire@gmail.com> - 2016-10-21 03:49 -0700
        Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-22 20:02 -0700
        Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-22 20:13 -0700
          Re: 1 /STRING vs SNIP trans <transfire@gmail.com> - 2016-10-22 21:09 -0700
            Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-23 18:36 -0700
          Re: 1 /STRING vs SNIP alex <alex@rivadpm.com> - 2016-10-27 14:07 +0100
            Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-27 19:12 -0700
              Re: 1 /STRING vs SNIP alex <alex@rivadpm.com> - 2016-10-28 19:39 +0100
                Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-28 20:26 -0700
    Re: 1 /STRING vs SNIP foxaudioresearch@gmail.com - 2016-10-26 19:52 -0700
      Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-27 09:42 +0000
        Re: 1 /STRING vs SNIP foxaudioresearch@gmail.com - 2016-10-27 06:46 -0700
        Re: 1 /STRING vs SNIP stephen@mpeforth.com (Stephen Pelc) - 2016-10-28 07:31 +0000
          Re: 1 /STRING vs SNIP jim <anon@example.com> - 2016-10-28 11:33 +0100
          Re: 1 /STRING vs SNIP jasmijn Bonting <tessa.bonting@gmail.com> - 2016-10-28 04:09 -0700
            Re: 1 /STRING vs SNIP stephen@mpeforth.com (Stephen Pelc) - 2016-10-28 12:41 +0000
            Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-28 16:50 +0000
              Re: 1 /STRING vs SNIP Chris Curl <ccurl609@gmail.com> - 2016-10-28 10:59 -0700
                Re: 1 /STRING vs SNIP anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-10-29 10:17 +0000
  Re: 1 /STRING vs SNIP "HAA" <someone@microsoft.com> - 2016-10-19 20:19 +1000
    Re: 1 /STRING vs SNIP foxaudioresearch@gmail.com - 2016-10-19 05:12 -0700
  1 /STRING vs SNIP trans <transfire@gmail.com> - 2016-10-21 04:07 -0700
    Re: 1 /STRING vs SNIP albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-21 15:50 +0200
    Re: 1 /STRING vs SNIP hughaguilar96@gmail.com - 2016-10-25 16:38 -0700
      Re: 1 /STRING vs SNIP "David N. Williams" <williams@umich.edu> - 2016-10-26 10:50 -0400
        Re: 1 /STRING vs SNIP "David N. Williams" <williams@umich.edu> - 2016-10-26 10:53 -0400
        Re: 1 /STRING vs SNIP albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-26 17:33 +0200
          Re: 1 /STRING vs SNIP "David N. Williams" <williams@umich.edu> - 2016-10-27 10:16 -0400
            Re: 1 /STRING vs SNIP Doug Hoffman <glidedog@gmail.com> - 2016-10-27 17:01 -0400
          Re: 1 /STRING vs SNIP Coos Haak <htrofhc@gmail.com> - 2016-10-27 17:00 +0200
  Re: 1 /STRING vs SNIP Hans Bezemer <the.beez.speaks@gmail.com> - 2016-10-22 12:25 +0200

csiph-web