OCaml Forge
SCM

Detail: [#45] Unable to use alphabetic infix operators

Bugs: Browse | Download .csv | Monitor

[#45] Unable to use alphabetic infix operators

Date:
2008-08-14 15:46
Priority:
3
State:
Open
Submitted by:
Hezekiah Carty (hcarty)
Assigned to:
Christophe Troestler (chris)
Hardware:
None
Resolution:
None
Severity:
normal
Version:
None
Component:
None
Operating System:
None
Product:
None
 
URL:
Summary:
Unable to use alphabetic infix operators

Detailed description
I attempted to to use the alphabetic infix operator example from the main pa-do page from the OCaml toplevel, but it does not work for me (some output cut):

-----
# #use "topfind";;
# #camlp4o;;
# #load "pa_infix.cmo";;
# INFIX subset LEVEL ( && );;
# let (subset) = (+);;
val subset : int -> int -> int = <fun>
# 1 subset 2;;
Characters 0-1:
1 subset 2;;
^
This expression is not a function, it cannot be applied
-----

The same errors occurs for POSTFIX-defined operators. Precedence does not seem to stick for prefix operators either:

-----
# PREFIX pref LEVEL ( ! );;
# let (pref) a = a + 1;;
val pref : int -> int = <fun>
# print_int pref 1;;
Characters 0-9:
print_int pref 1;;
^^^^^^^^^
This function is applied to too many arguments,
maybe you forgot a `;'
-----

Non-alphabetic operators seem to work without issue loading pa_infix.cmo in this manner.

This is using OCaml 3.10.2, AMD64, installed through GODI and the latest pa-do from bzr.

Followup

Message
Date: 2008-11-06 21:10
Sender: Hezekiah Carty

This may have been due to either an error on my part, or the camlp4 + toplevel bug(s) which exist in OCaml 3.10.x. Using the patch provided here:

http://camlcvs.inria.fr/cgi-bin/cvsweb/ocaml/camlp4/Camlp4Top/Top.ml.diff?r1=1.4;r2=1.4.4.1;f=h

alphabetic infix operators seem to work as expected, both in the toplevel and in compiled code. This patch should end up in OCaml 3.11.0.

Attached Files:

Changes:

Field Old Value Date By
assigned_tonone2008-12-18 20:22chris