caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Should a /\ operator be possible?
@ 2008-05-01 19:41 Richard Jones
  2008-05-01 21:20 ` [Caml-list] " Richard Jones
  0 siblings, 1 reply; 14+ messages in thread
From: Richard Jones @ 2008-05-01 19:41 UTC (permalink / raw)
  To: caml-list

Should code like this be possible?

  let ( /\ ) (a1, a2) (b1, b2) = a2 > b1 || b2 > a1

This is accepted by camlp4 (3.10.1 & 3.10.2) but rejected by pure
ocamlc and also by ocamldoc.

$ ocamlc -pp camlp4of test.ml
<nothing printed>

$ ocamlc test.ml
File "test.ml", line 1, characters 7-8:
Illegal character (\\)

Rich.

-- 
Richard Jones
Red Hat


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Caml-list] Should a /\ operator be possible?
  2008-05-01 19:41 Should a /\ operator be possible? Richard Jones
@ 2008-05-01 21:20 ` Richard Jones
  2008-05-01 21:36   ` Hezekiah M. Carty
                     ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Richard Jones @ 2008-05-01 21:20 UTC (permalink / raw)
  To: caml-list

On Thu, May 01, 2008 at 08:41:49PM +0100, Richard Jones wrote:
>   let ( /\ ) (a1, a2) (b1, b2) = a2 > b1 || b2 > a1

I've just reread the Lexical conventions section in the manual.  For
some reason when I read it first I thought it said that '\' was
allowed, but in fact it's not so this appears to be a bug in camlp4.

BUT can we permit this?  It's nice to be able to define /\ and \/
operators with the obvious meanings :-)

In fact can we open the discussion about converting OCaml source files
into UTF-8 and allow _lots_ more symbols?  eg:

  let (∪) = ...
  let (⊆) = ...

Rich.

-- 
Richard Jones
Red Hat


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Caml-list] Should a /\ operator be possible?
  2008-05-01 21:20 ` [Caml-list] " Richard Jones
@ 2008-05-01 21:36   ` Hezekiah M. Carty
  2008-05-02  7:44     ` Gordon Henriksen
  2008-05-02  6:43   ` Vincent Hanquez
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Hezekiah M. Carty @ 2008-05-01 21:36 UTC (permalink / raw)
  To: Richard Jones; +Cc: caml-list

On Thu, May 1, 2008 at 5:20 PM, Richard Jones <rich@annexia.org> wrote:
> On Thu, May 01, 2008 at 08:41:49PM +0100, Richard Jones wrote:
>  >   let ( /\ ) (a1, a2) (b1, b2) = a2 > b1 || b2 > a1
>
>  I've just reread the Lexical conventions section in the manual.  For
>  some reason when I read it first I thought it said that '\' was
>  allowed, but in fact it's not so this appears to be a bug in camlp4.
>
>  BUT can we permit this?  It's nice to be able to define /\ and \/
>  operators with the obvious meanings :-)
>
>  In fact can we open the discussion about converting OCaml source files
>  into UTF-8 and allow _lots_ more symbols?  eg:
>
>   let (∪) = ...
>   let (⊆) = ...

Did this come up at the OCaml meeting [1]?  I think Xavier Leroy said
something about updating OCaml to allow UTF-x source files, though I
have only read the transcripts and don't know the full context or how
official this is.

Hez

[1] - http://wiki.cocan.org/events/europe/ocamlmeetingparis2008

-- 
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Caml-list] Should a /\ operator be possible?
  2008-05-01 21:20 ` [Caml-list] " Richard Jones
  2008-05-01 21:36   ` Hezekiah M. Carty
@ 2008-05-02  6:43   ` Vincent Hanquez
  2008-05-02  8:05   ` David Teller
  2008-05-02  9:23   ` Alain Frisch
  3 siblings, 0 replies; 14+ messages in thread
From: Vincent Hanquez @ 2008-05-02  6:43 UTC (permalink / raw)
  To: Richard Jones; +Cc: caml-list

On Thu, May 01, 2008 at 10:20:23PM +0100, Richard Jones wrote:
> In fact can we open the discussion about converting OCaml source files
> into UTF-8 and allow _lots_ more symbols?  eg:
> 
>   let (∪) = ...
>   let (⊆) = ...

on one hand, it probably would be nice to have such a massive extend of
symbols.. on the other hand, it could be quite unproductive for
writing/reading code since there's so much symbols, and that some looks
like others; for example 'u' and '∪', '‧' and '.', '‶' and '"' etc..

plus, i don't really want to have my character table open when i want to
edit a program ...

-- 
Vincent


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Caml-list] Should a /\ operator be possible?
  2008-05-01 21:36   ` Hezekiah M. Carty
@ 2008-05-02  7:44     ` Gordon Henriksen
  0 siblings, 0 replies; 14+ messages in thread
From: Gordon Henriksen @ 2008-05-02  7:44 UTC (permalink / raw)
  To: Hezekiah M. Carty; +Cc: Richard Jones, caml-list

Maybe Unicode support in the standard library should come before  
Unicode identifiers in the sources.

On 2008-05-01, at 17:36, Hezekiah M. Carty wrote:

> On Thu, May 1, 2008 at 5:20 PM, Richard Jones <rich@annexia.org>  
> wrote:
>> On Thu, May 01, 2008 at 08:41:49PM +0100, Richard Jones wrote:
>>>  let ( /\ ) (a1, a2) (b1, b2) = a2 > b1 || b2 > a1
>>
>> I've just reread the Lexical conventions section in the manual.  For
>> some reason when I read it first I thought it said that '\' was
>> allowed, but in fact it's not so this appears to be a bug in camlp4.
>>
>> BUT can we permit this?  It's nice to be able to define /\ and \/
>> operators with the obvious meanings :-)
>>
>> In fact can we open the discussion about converting OCaml source  
>> files
>> into UTF-8 and allow _lots_ more symbols?  eg:
>>
>>  let (∪) = ...
>>  let (⊆) = ...
>
> Did this come up at the OCaml meeting [1]?  I think Xavier Leroy said
> something about updating OCaml to allow UTF-x source files, though I
> have only read the transcripts and don't know the full context or how
> official this is.
>
> Hez
>
> [1] - http://wiki.cocan.org/events/europe/ocamlmeetingparis2008
>
> -- 
> Hezekiah M. Carty
> Graduate Research Assistant
> University of Maryland
> Department of Atmospheric and Oceanic Science
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs



— Gordon


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Caml-list] Should a /\ operator be possible?
  2008-05-01 21:20 ` [Caml-list] " Richard Jones
  2008-05-01 21:36   ` Hezekiah M. Carty
  2008-05-02  6:43   ` Vincent Hanquez
@ 2008-05-02  8:05   ` David Teller
  2008-05-02  8:26     ` Richard Jones
  2008-05-02  9:23   ` Alain Frisch
  3 siblings, 1 reply; 14+ messages in thread
From: David Teller @ 2008-05-02  8:05 UTC (permalink / raw)
  To: Richard Jones; +Cc: caml-list

Actually, I remember Xavier Leroy saying that there was no problem, as
soon as we were able to decide exactly what's a symbol, what's a letter,
etc.

Cheers,
 David

> In fact can we open the discussion about converting OCaml source files
> into UTF-8 and allow _lots_ more symbols?  eg:
> 
>   let (∪) = ...
>   let (⊆) = ...
> 
> Rich.
> 
-- 
David Teller
 Security of Distributed Systems
  http://www.univ-orleans.fr/lifo/Members/David.Teller
 Angry researcher: French Universities need reforms, but the LRU act brings liquidations. 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Caml-list] Should a /\ operator be possible?
  2008-05-02  8:05   ` David Teller
@ 2008-05-02  8:26     ` Richard Jones
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Jones @ 2008-05-02  8:26 UTC (permalink / raw)
  To: David Teller; +Cc: caml-list

On Fri, May 02, 2008 at 10:05:05AM +0200, David Teller wrote:
> Actually, I remember Xavier Leroy saying that there was no problem, as
> soon as we were able to decide exactly what's a symbol, what's a letter,

Luckily Unicode defines such classes already.  There's a very high
level overview in this Wikipedia article:

  http://en.wikipedia.org/wiki/Mapping_of_Unicode_characters

We'd probably want to concentrate on a subset of the mathematical
operators first:

  http://en.wikipedia.org/wiki/Unicode_Mathematical_Operators

There's even support for this in OCaml already:

  http://camomile.sourceforge.net/dochtml-0.6/UCharInfo.html

Rich.

-- 
Richard Jones
Red Hat


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Caml-list] Should a /\ operator be possible?
  2008-05-01 21:20 ` [Caml-list] " Richard Jones
                     ` (2 preceding siblings ...)
  2008-05-02  8:05   ` David Teller
@ 2008-05-02  9:23   ` Alain Frisch
  2008-05-02 11:54     ` Daniel Bünzli
                       ` (2 more replies)
  3 siblings, 3 replies; 14+ messages in thread
From: Alain Frisch @ 2008-05-02  9:23 UTC (permalink / raw)
  To: Richard Jones; +Cc: caml-list

Richard Jones wrote:
> In fact can we open the discussion about converting OCaml source files
> into UTF-8 and allow _lots_ more symbols?  eg:
> 
>   let (∪) = ...
>   let (⊆) = ...

Shouldn't this desire of using mathematical symbols be addressed at the 
level of your editor / IDE instead?  If the language allowed you to 
define and use alphanumeric infix operators like:

   let (`subseteq`) = ...
   if (x `subseteq` y) then ...

then you could simply inform your editor that it should display 
`subseteq` as ⊆. The tuareg mode already does this kind of 
"symbolification" of some operators like -> (displayed as an arrow) and 
'a (display as a Greek alpha) and it shouldn't be too difficult to 
extend that to user-defined operators.

-- Alain


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Caml-list] Should a /\ operator be possible?
  2008-05-02  9:23   ` Alain Frisch
@ 2008-05-02 11:54     ` Daniel Bünzli
  2008-05-05  6:36       ` Maxence Guesdon
  2008-05-02 14:27     ` Robert Fischer
  2008-05-02 15:11     ` Hezekiah M. Carty
  2 siblings, 1 reply; 14+ messages in thread
From: Daniel Bünzli @ 2008-05-02 11:54 UTC (permalink / raw)
  To: List caml-list


The unicode standard dicusses a syntax for identifiers here [1]. Note  
that determining if two identifiers are equal needs to invoke the  
unicode normalization machinery, it is not just a matter of knowing  
what is a letter and a symbol. That being said, I really don't see  
unicode identifiers as a must have feature, au contraire.

Regarding the use of math symbols, I think Alain is right, it should  
be addressed as a presentation issue. Actually that's the way Fortress  
[3] handles it, as a rendering issue.

Speaking of using UTF-8 in source files, it was recently pointed out  
to me that this is not a problem as long as you use only ASCII  
identifiers. The advantage is that you can have UTF-8 string literals  
in your source code.

Best,

Daniel

[1] http://www.unicode.org/reports/tr31/
[2] http://research.sun.com/projects/plrg/Publications/fortress.1.0.pdf


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Caml-list] Should a /\ operator be possible?
  2008-05-02  9:23   ` Alain Frisch
  2008-05-02 11:54     ` Daniel Bünzli
@ 2008-05-02 14:27     ` Robert Fischer
  2008-05-02 17:02       ` Yann Régis-Gianas
  2008-05-02 15:11     ` Hezekiah M. Carty
  2 siblings, 1 reply; 14+ messages in thread
From: Robert Fischer @ 2008-05-02 14:27 UTC (permalink / raw)
  To: caml-list

Yeah, I vote against having to type Alt+number to edit someone else's
code.  I'd rather that we start allowing LaTeX symbols in our source
before we actually have the Unicode symbols themselves in there.

Oh, and +1 for actually supporting Unicode in String processing.

~~ Robert.

Alain Frisch wrote:
> Richard Jones wrote:
>> In fact can we open the discussion about converting OCaml source files
>> into UTF-8 and allow _lots_ more symbols?  eg:
>>
>>   let (∪) = ...
>>   let (⊆) = ...
>
> Shouldn't this desire of using mathematical symbols be addressed at
> the level of your editor / IDE instead?  If the language allowed you
> to define and use alphanumeric infix operators like:
>
>   let (`subseteq`) = ...
>   if (x `subseteq` y) then ...
>
> then you could simply inform your editor that it should display
> `subseteq` as ⊆. The tuareg mode already does this kind of
> "symbolification" of some operators like -> (displayed as an arrow)
> and 'a (display as a Greek alpha) and it shouldn't be too difficult to
> extend that to user-defined operators.
>
> -- Alain
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Caml-list] Should a /\ operator be possible?
  2008-05-02  9:23   ` Alain Frisch
  2008-05-02 11:54     ` Daniel Bünzli
  2008-05-02 14:27     ` Robert Fischer
@ 2008-05-02 15:11     ` Hezekiah M. Carty
  2008-05-02 15:25       ` Alain Frisch
  2 siblings, 1 reply; 14+ messages in thread
From: Hezekiah M. Carty @ 2008-05-02 15:11 UTC (permalink / raw)
  To: Alain Frisch; +Cc: Richard Jones, caml-list

On Fri, May 2, 2008 at 5:23 AM, Alain Frisch <alain@frisch.fr> wrote:
>  Shouldn't this desire of using mathematical symbols be addressed at the
> level of your editor / IDE instead?

Perhaps this idea should be presented to the ocamlwizard OSP group
[1]?  It may be something that they could integrate in to their IDE
tools.

Hez

[1] - http://osp.janestcapital.com/wordpress/?p=22

-- 
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Caml-list] Should a /\ operator be possible?
  2008-05-02 15:11     ` Hezekiah M. Carty
@ 2008-05-02 15:25       ` Alain Frisch
  0 siblings, 0 replies; 14+ messages in thread
From: Alain Frisch @ 2008-05-02 15:25 UTC (permalink / raw)
  To: Hezekiah M. Carty; +Cc: caml-list

Hezekiah M. Carty wrote:
> Perhaps this idea should be presented to the ocamlwizard OSP group
> [1]?  It may be something that they could integrate in to their IDE
> tools.

 From what I understand of the ocamlwizard OSP (which, btw, I find 
excessively cool), the idea is not to provide yet another IDE, but 
instead to develop reusable tools/libraries that can be used by several 
IDEs. I don't really see what can be factored out from the task under 
consideration (displaying some funny symbols for `subseteq` -- once it 
this is allowed as an infix operator by the compiler).

-- Alain


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Caml-list] Should a /\ operator be possible?
  2008-05-02 14:27     ` Robert Fischer
@ 2008-05-02 17:02       ` Yann Régis-Gianas
  0 siblings, 0 replies; 14+ messages in thread
From: Yann Régis-Gianas @ 2008-05-02 17:02 UTC (permalink / raw)
  To: Robert Fischer; +Cc: caml-list

Note that emacs22 has a TeX input mode which enables you to write TeX
commands instead of tedious numeric code. I use it for my Coq
development, \forall in the emacs buffer is translated to the
corresponding unicode symbol on-the-fly.

On Fri, May 2, 2008 at 4:27 PM, Robert Fischer
<Robert@fischerventure.com> wrote:
> Yeah, I vote against having to type Alt+number to edit someone else's
>  code.  I'd rather that we start allowing LaTeX symbols in our source
>  before we actually have the Unicode symbols themselves in there.
>
>  Oh, and +1 for actually supporting Unicode in String processing.
>
>  ~~ Robert.
>
>
>
>  Alain Frisch wrote:
>  > Richard Jones wrote:
>  >> In fact can we open the discussion about converting OCaml source files
>  >> into UTF-8 and allow _lots_ more symbols?  eg:
>  >>
>  >>   let (∪) = ...
>  >>   let (⊆) = ...
>  >
>  > Shouldn't this desire of using mathematical symbols be addressed at
>  > the level of your editor / IDE instead?  If the language allowed you
>  > to define and use alphanumeric infix operators like:
>  >
>  >   let (`subseteq`) = ...
>  >   if (x `subseteq` y) then ...
>  >
>  > then you could simply inform your editor that it should display
>  > `subseteq` as ⊆. The tuareg mode already does this kind of
>  > "symbolification" of some operators like -> (displayed as an arrow)
>  > and 'a (display as a Greek alpha) and it shouldn't be too difficult to
>  > extend that to user-defined operators.
>  >
>  > -- Alain
>  >
>  > _______________________________________________
>  > Caml-list mailing list. Subscription management:
>  > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
>  > Archives: http://caml.inria.fr
>  > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>  > Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>  _______________________________________________
>  Caml-list mailing list. Subscription management:
>  http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
>  Archives: http://caml.inria.fr
>  Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>  Bug reports: http://caml.inria.fr/bin/caml-bugs
>



-- 
Yann Régis-Gianas

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Caml-list] Should a /\ operator be possible?
  2008-05-02 11:54     ` Daniel Bünzli
@ 2008-05-05  6:36       ` Maxence Guesdon
  0 siblings, 0 replies; 14+ messages in thread
From: Maxence Guesdon @ 2008-05-05  6:36 UTC (permalink / raw)
  To: caml-list

On Fri, 2 May 2008 13:54:37 +0200
Daniel Bünzli <daniel.buenzli@erratique.ch> wrote:

> 
> The unicode standard dicusses a syntax for identifiers here [1]. Note  
> that determining if two identifiers are equal needs to invoke the  
> unicode normalization machinery, it is not just a matter of knowing  
> what is a letter and a symbol. That being said, I really don't see  
> unicode identifiers as a must have feature, au contraire.
> 
> Regarding the use of math symbols, I think Alain is right, it should  
> be addressed as a presentation issue. Actually that's the way Fortress  
> [3] handles it, as a rendering issue.

Chamo, the source code editor coming with Cameleon, has such a rendering
feature, and here is an example snippet to use greek letters in the editor:
  http://home.gna.org/cameleon/snippets.en.html
It's up the the user to define his own mapping function between source file
and utf8 text displayed.

Regards,

Maxence


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-05-05  6:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-01 19:41 Should a /\ operator be possible? Richard Jones
2008-05-01 21:20 ` [Caml-list] " Richard Jones
2008-05-01 21:36   ` Hezekiah M. Carty
2008-05-02  7:44     ` Gordon Henriksen
2008-05-02  6:43   ` Vincent Hanquez
2008-05-02  8:05   ` David Teller
2008-05-02  8:26     ` Richard Jones
2008-05-02  9:23   ` Alain Frisch
2008-05-02 11:54     ` Daniel Bünzli
2008-05-05  6:36       ` Maxence Guesdon
2008-05-02 14:27     ` Robert Fischer
2008-05-02 17:02       ` Yann Régis-Gianas
2008-05-02 15:11     ` Hezekiah M. Carty
2008-05-02 15:25       ` Alain Frisch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).