[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon May 9 14:10:20 2001 
Subject:Re: Editing filenames with spaces 
From: 
Volume-ID:1010509.04 

In article <9dbgjf$24m$1@soapbox.cs.bham.ac.uk>,
	jonathan.cunningham@tesco.net writes:
 
> I suppose it is too late to swap the roles of single and double
> quotes in the pop11 language, but if we were designing it now, I
> suspect we would use double quotes as string quotes.

In my descended-from-Pop language Pepper I did indeed eventually
swop the quotes round. (An interesting rebootstrapping problem it was,
too.) 
 
> How about this, as a new lexical syntax proposal (somewhat tongue-in
> cheek, since no one will take it seriously):
> 
> OLD
> 'this is a string'
> "word"
> 'c' ;;; a character
> 
> NEW
> "this is a string"
> 'word
> 'c' ;;; a character

I chose double-quotes for "strings", single-quotes for 'a' character,
and back-quotes for `words`.
 
> Note that word quote is an *un* matched single quote. The single quote
> for quoting words is, of course, lisp-like. And quite unambiguous, I
> think.

Is ['c'd] a List(Char, Char) or a List(Word,Word)?

Actually I lied about the back-quotes. Pepper back-quotes enclose *any
number* of words, eg 'two words' or 'three little boys'.

Actually that was still a lie. PBQs quote [] lists and {} vectors too
(which are not self-quoting in Pepper).  

Jonathan's examples become:

>  'this\ is\ a\ word

    `\"this is a word"`

(strings are self-quoting in backquotes; backslashing them converts
them into words).
  
>  'this\ is\ two\ words'.

`\"this is two words" .`  ;;; I think that's what you meant.

>  "this\ is\ a\ string". ;;; followed by a dot

"this is a string".

>  'c'-> foo; assigning a character to foo

No change.

>  'c '-> foo; a syntax error

No change (but see below).

>  'c-> foo; assigning a word to foo

`c` -> foo;

>  '+ -> foo; assigning a word to foo

`+` -> foo;

>  '+-> foo; a syntax error

Ditto. Note that

    `+- -> foo;

is an unterminated quote context, which will eat tokens until the matching
backquote or end-of-file. This is a design decision I'm not entirely happy
with.

>  '+'-> foo; assigning a character to foo

Ditto.

>  '+-> ->foo; assigning a word to foo

`+->` -> foo;

In Spice (a language Steve and I have co-developed and Whose Status Is 
Under Review), character quotes may quote *arbitrarily many* characters,
and evaluate to all of those characters in sequence, ie

    'burble'
is
    'b', 'u', 'r', 'b', 'l', 'e'

(Thus the difference between double quotes and single quotes is that the
double quotes are "stronger" and force all the characters together into
a single lump. We did seriously consider abandoning the distinction
between strings and words, in both Pepper and Spice, but decided that
it's pragmatically useful. The current Pepper implementation is such that
a Word looks just like a String to all String operations; I mean, it
*really* looks like a String, not that there's code which says, oh, it's
a word, get the string part. The next-in-dictionary link comes *before*
the key-and-length, not after).

-- 
Chris "designer ... jeans? no, *languages*." Dollin
C FAQs at: http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.c.html