Eric Allen | 25 Apr 23:19
Favicon

Allow :: as a Fortress operator

Proposal: Allow :: as a Fortress operator. In ML, this operator is  
used to adjoin elements to lists. We don't necessarily have to define  
it in this way in the standard libraries, but we can at least make it  
available for definition to programmers. There should be no syntactic  
ambiguity in allowing it in Fortress, so why not allow it?

-- Eric

Jan-Willem Maessen | 25 Apr 23:57
Favicon

Re: Allow :: as a Fortress operator

On Apr 25, 2008, at 5:19 PM, Eric Allen wrote:

> Proposal: Allow :: as a Fortress operator.
> We don't necessarily have to define it in this way in the standard  
> libraries, but we can at least make it available for definition to  
> programmers. There should be no syntactic ambiguity in allowing it  
> in Fortress, so why not allow it?

Reductio: Why not allow any multi-operator-character sequence to be a  
fortress operator?  My understanding is that the answer is "stick with  
the operators in unicode, that have a conventional meaning".

That said, I believe unicode has the operator you want.

I thought maybe :: might have been the 3-place range factory...

-Jan

>
>
> -- Eric
>

Victor Luchangco | 26 Apr 01:06
Favicon

Re: Allow :: as a Fortress operator


On Apr 25, 2008, at 5:57 PM, Jan-Willem Maessen wrote:

> On Apr 25, 2008, at 5:19 PM, Eric Allen wrote:
>
>> Proposal: Allow :: as a Fortress operator.
>> We don't necessarily have to define it in this way in the standard  
>> libraries, but we can at least make it available for definition to  
>> programmers. There should be no syntactic ambiguity in allowing it  
>> in Fortress, so why not allow it?
>
> Reductio: Why not allow any multi-operator-character sequence to be  
> a fortress operator?  My understanding is that the answer is "stick  
> with the operators in unicode, that have a conventional meaning".
>
> That said, I believe unicode has the operator you want.

I was wondering what operator you were talking about--a quick search  
on unicode.org didn't yield any "double colon" operator, but looking  
at the code charts, the reference rendering of U+2237 PROPORTION  
looks very much like a double colon operator.  This is already an  
allowed operator in Fortress (see appendix listing all the operators).

I think we want to hold off as much as possible on allowing  
multicharacter operators.  Currently, the only multicharacter  
operators are enclosers, as defined in the Multicharacter Enclosing  
Operators section of the Lexical Structure chapter, which cause  
enough parsing complications.  If a "multicharacter" operator really  
deserves special treatment, I think we should try to get the Unicode  
folks to give it a character of its own, as they already do for COLON  
(Continue reading)

Eric Allen | 26 Apr 21:36
Favicon

Re: Allow :: as a Fortress operator


On Apr 25, 2008, at 6:06 PM, Victor Luchangco wrote:

> I think we want to hold off as much as possible on allowing  
> multicharacter operators.  Currently, the only multicharacter  
> operators are enclosers, as defined in the Multicharacter Enclosing  
> Operators section of the Lexical Structure chapter, which cause  
> enough parsing complications.  If a "multicharacter" operator really  
> deserves special treatment, I think we should try to get the Unicode  
> folks to give it a character of its own, as they already do for  
> COLON EQUALS, for example.

Don't forget that every token that is made up of a mixture of  
uppercase letters and underscores (but no digits), does not begin or  
end with an underscore, and contains at least two different letters is  
also considered to be an operator. So we already have a very large  
space of multicharacter operators.

-- Eric

Victor Luchangco | 26 Apr 21:51
Favicon

Re: Allow :: as a Fortress operator

On Apr 26, 2008, at 3:36 PM, Eric Allen wrote:

> On Apr 25, 2008, at 6:06 PM, Victor Luchangco wrote:
>
>> I think we want to hold off as much as possible on allowing  
>> multicharacter operators.  Currently, the only multicharacter  
>> operators are enclosers, as defined in the Multicharacter  
>> Enclosing Operators section of the Lexical Structure chapter,  
>> which cause enough parsing complications.  If a "multicharacter"  
>> operator really deserves special treatment, I think we should try  
>> to get the Unicode folks to give it a character of its own, as  
>> they already do for COLON EQUALS, for example.
>
> Don't forget that every token that is made up of a mixture of  
> uppercase letters and underscores (but no digits), does not begin  
> or end with an underscore, and contains at least two different  
> letters is also considered to be an operator. So we already have a  
> very large space of multicharacter operators.

Yeah, sorry--I meant multicharacter, nonword tokens.  We parse words  
and nonwords completely differently, or at least we specify the  
parsing completely differently.  The only complications with words  
(i.e., contiguous sequences of letters, digits, underscores, primes,  
etc.) that I recall had to do with handling numbers, specifically in  
dealing with the decimal/radix point and possible radix specifier and  
allowing small spaces to separate groups of digits.

In any case, as Guy points out, there are syntactic problems posed  
specifically by allowing :: as an operator.  And as Jan pointed out,  
there's already a Unicode character that looks like what you want (U 
(Continue reading)

Eric Allen | 26 Apr 22:01
Favicon

Re: Allow :: as a Fortress operator


On Apr 26, 2008, at 2:51 PM, Victor Luchangco wrote:

> In any case, as Guy points out, there are syntactic problems posed  
> specifically by allowing :: as an operator.

Yes, I'm not keen on introducing more syntactic complexity (but see  
below).

> And as Jan pointed out, there's already a Unicode character that  
> looks like what you want (U+2237).

Actually, given that this character exists, I'm strongly in favor of  
supporting :: as the ASCII encoding for it. I find it very frustrating  
when I can't denote a Unicode character by its obvious ASCII encoding.

-- Eric

Jan-Willem Maessen | 26 Apr 22:40
Favicon

Re: Allow :: as a Fortress operator


On Apr 26, 2008, at 4:01 PM, Eric Allen wrote:
>
> Actually, given that this character exists, I'm strongly in favor of  
> supporting :: as the ASCII encoding for it. I find it very  
> frustrating when I can't denote a Unicode character by its obvious  
> ASCII encoding.

That seems an eminently reasonable wish, assuming we can sort out the  
syntactic ambiguities it entails.  It's those ambiguities that really  
worry me.

-Jan

>
>
> -- Eric
>

Guy.Steele | 25 Apr 23:58
Favicon

Re: Allow :: as a Fortress operator

----- Original Message -----
From: Eric Allen <Eric.Allen@...>
Date: Friday, April 25, 2008 5:19 pm
Subject: Allow :: as a Fortress operator

> Proposal: Allow :: as a Fortress operator. In ML, this operator is  
> used to adjoin elements to lists. We don't necessarily have to 
> define  
> it in this way in the standard libraries, but we can at least make 
> it  
> available for definition to programmers. There should be no 
> syntactic  
> ambiguity in allowing it in Fortress, so why not allow it?
> 
> -- Eric

This would interact with the syntax of ranges; either we would have to require
that no space appear between the colons in certain in range expressions
(that is,  3 :: 5  would be valid but  3 : : 5  would not), or the implementor of
ranges would have to provide redundant operator definitions to cater to both.

Also, FWIW, there is a reasonable plan, once we have value types,
to implement lists in such a way that  <| x |> || y  would be just as efficient
as  x :: y .  The former is a bit more verbose but also more widely understood,

(I might add that I have a slight distaste for using symmetric symbols
for asymmetric operations, but that's just me.)

Given all that, what is the proposed use case for a separate :: operator?

(Continue reading)

Eric Allen | 26 Apr 21:42
Favicon

Re: Allow :: as a Fortress operator


On Apr 25, 2008, at 5:00 PM, Guy.Steele@... wrote:

> Given all that, what is the proposed use case for a separate ::  
> operator?

Well, I wanted to define :: to denote FJ typing judgements. I could  
just use a single colon instead (and ultimately I decided to do so)  
but I was trying to syntactically distinguish meta-level and object- 
level type annotations. But I was mainly just surprised that :: was  
not a valid operator; it struck me as a character sequence that would  
naturally be included as an operator.

-- Eric


Gmane