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


Groups > comp.lang.forth > #10040

Re: Question on CHAR and [CHAR]

Newsgroups comp.lang.forth
From Albert van der Horst <albert@spenarnc.xs4all.nl>
Subject Re: Question on CHAR and [CHAR]
Date 2012-03-12 11:13 +0000
Message-ID <m0rr5v.2kk@spenarnc.xs4all.nl> (permalink)
Organization Dutch Forth Workshop
References <jjhtn6$b3r$1@speranza.aioe.org> <jjj451$k5r$1@speranza.aioe.org>

Show all headers | View raw


In article <jjj451$k5r$1@speranza.aioe.org>,
Rod Pemberton <do_not_have@noavailemail.cmm> wrote:
>"Rod Pemberton" <do_not_have@noavailemail.cmm> wrote in message
>news:jjhtn6$b3r$1@speranza.aioe.org...
>>
>> In interactive mode, CHAR gives:
>>
>>   CHAR A . 65 <ok>
>>
>> In compilation mode, [CHAR] gives:
>>
>>   : T [CHAR] A . ; <ok>
>>   T 65 <ok>
>>
>> However, the three ANS Forths I tried *also* support the following usage:
>>
>> : T CHAR 'A' . ; <ok>
>> T 65 <ok>
>>
>> Now, AFAICT, CHAR and [CHAR] were originally defined for ANS.  They aren't
>> defined for fig-Forth, F79, or F83.  Although I expect 'A' to work from my
>> experiences with other languages and that's how I stumbled across this, I
>> see no mention of this syntax in ANS.  The supported syntax also uses CHAR
>> in compile mode instead of [CHAR] ...  It doesn't seem to fit F83's
>> definition of ASCII either ...  So, where does this usage come from?
>>
>
>Ok, you guys answered:
>
>  "The 'n' syntax is separate from and unrelated to CHAR."
>
>So, clearly ' followed by a non-space indicates a character ...  Otherwise,
>it'd be ' (tick).

And it is a reason to hate the syntax, because it is confusing.

>
>It seems (as someone mentioned) that some Forths require two apostrophe's
>while others only need one, e.g., 'A vs. 'A' .

The second apostrophe is superfluous in Forth and is a typical c-ism.
It is interesting that where it would be beneficial (using 0x over $
to indicate hex) Forthers shy away from c-isms.

[I could easily make $HOME work in ciforth but $ for hex is in the way.]

>
>Does this syntax work for space too?  E.g.,
>
>: T ' ' . ;
>(space inside apostrophe's)

Have you even read Starting Forth? Have you even read through a
glossary and wondered why BL is defined?

>
>As expected, that seems to not recognize a space ...
>
>This use of ' for a character raises another question too.  How does the
>character syntax with ' work with a space delimited parser like that used in
>Forth?  I.e., there is no space afterwards.
>
>
>Rod Pemberton

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

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


Thread

Question on CHAR and [CHAR] "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-11 06:10 -0400
  Re: Question on CHAR and [CHAR] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-11 06:03 -0500
  Re: Question on CHAR and [CHAR] Coos Haak <chforth@hccnet.nl> - 2012-03-11 13:09 +0100
    Re: Question on CHAR and [CHAR] "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-12 19:43 -0400
      Re: Question on CHAR and [CHAR] "Elizabeth D. Rather" <erather@forth.com> - 2012-03-12 16:22 -1000
        Re: Question on CHAR and [CHAR] Mark Wills <markrobertwills@yahoo.co.uk> - 2012-03-13 03:23 -0700
        Re: Question on CHAR and [CHAR] Josh Grams <josh@qualdan.com> - 2012-03-13 12:51 +0000
  Re: Question on CHAR and [CHAR] Josh Grams <josh@qualdan.com> - 2012-03-11 17:11 +0000
    Re: Question on CHAR and [CHAR] Jean-Bernard Faucon <jb@nospam.com> - 2012-03-11 21:34 +0100
    Re: Question on CHAR and [CHAR] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 10:45 +0000
  Re: Question on CHAR and [CHAR] BruceMcF <agila61@netscape.net> - 2012-03-11 13:57 -0700
  Re: Question on CHAR and [CHAR] "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-11 17:06 -0400
    Re: Question on CHAR and [CHAR] Josh Grams <josh@qualdan.com> - 2012-03-11 21:38 +0000
      Re: Question on CHAR and [CHAR] "Elizabeth D. Rather" <erather@forth.com> - 2012-03-11 14:12 -1000
    Re: Question on CHAR and [CHAR] BruceMcF <agila61@netscape.net> - 2012-03-11 18:42 -0700
    Re: Question on CHAR and [CHAR] Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-12 11:13 +0000
      Re: Question on CHAR and [CHAR] "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-12 19:46 -0400
        Re: Question on CHAR and [CHAR] "Elizabeth D. Rather" <erather@forth.com> - 2012-03-12 16:56 -1000
  Re: Question on CHAR and [CHAR] "Ed" <nospam@invalid.com> - 2012-03-14 16:35 +1100
    Re: Question on CHAR and [CHAR] Alex McDonald <blog@rivadpm.com> - 2012-03-14 08:49 -0700
      Re: Question on CHAR and [CHAR] "Ed" <nospam@invalid.com> - 2012-03-15 12:29 +1100
        Re: Question on CHAR and [CHAR] "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-15 04:11 -0400
          Re: Question on CHAR and [CHAR] "Peter Knaggs" <pjk@bcs.org.uk> - 2012-03-15 10:24 +0000
            Re: Question on CHAR and [CHAR] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-15 06:23 -0500
              Re: Question on CHAR and [CHAR] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-15 12:05 +0000
                Re: Question on CHAR and [CHAR] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-15 08:19 -0500
          Re: Question on CHAR and [CHAR] "Ed" <nospam@invalid.com> - 2012-03-17 13:17 +1100
            Re: Question on CHAR and [CHAR] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-17 15:13 +0000
              Re: Question on CHAR and [CHAR] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-18 06:07 -0500
              Re: Question on CHAR and [CHAR] "Ed" <nospam@invalid.com> - 2012-03-18 23:01 +1100
                Re: Question on CHAR and [CHAR] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-18 15:21 +0000
                Re: Question on CHAR and [CHAR] Bernd Paysan <bernd.paysan@gmx.de> - 2012-03-18 23:15 +0100
        Re: Question on CHAR and [CHAR] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-15 11:59 +0000
    Re: Question on CHAR and [CHAR] "Ed" <nospam@invalid.com> - 2012-03-15 12:29 +1100

csiph-web