Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 110 lines (86 sloc) 4.628 kb
cfdb261 add Upgrading
garrigue authored
1
9c6e761 camlp4 under toplevel
garrigue authored
2 FAQ: how to upgrade from Objective Caml 3.02 to 3.03
cfdb261 add Upgrading
garrigue authored
3
4 I Installation
5
6 Q1: When compiling the distribution, I am getting strange linking
5299fde Fusion des modifs faites sur la branche release jusqu'a la release 3.…
xleroy authored
7 errors in "otherlibraries".
cfdb261 add Upgrading
garrigue authored
8
9 A1: This is probably a problem with dynamic linking. You can disable
10 it with ./configure -no-shared-libs. If you really want to use
11 shared libraries, look in the manual pages of your system for how
12 to get some debugging output from the dynamic linker.
13
14 II Non-label changes
15
16 Q2: I get a syntax error when I try to compile a program using stream
17 parsers.
18
19 A2: Stream parser now require camlp4. It is included in the
20 distribution, and you just need to use "ocamlc -pp camlp4o" in
9c6e761 camlp4 under toplevel
garrigue authored
21 place of "ocamlc". You can also use it under the toplevel with
22 #load"camlp4o.cma".
cfdb261 add Upgrading
garrigue authored
23
24 Q3: I get a warning when I use the syntax "#variant" inside type
25 expressions.
26
27 A3: The new syntax is [< variant], which just a special case of
28 the more general new syntax, which allows type expressions like
9c6e761 camlp4 under toplevel
garrigue authored
29 [ variant1 | variant2] or [> variant]. See the reference manual
cfdb261 add Upgrading
garrigue authored
30 for details.
31
32 III Label changes
33
34 Q4: I was using labels before, and now I get lots of type errors.
35
341d6fc Typos
xleroy authored
36 A4: The handling of labels changed with 3.03-alpha. The new default
cfdb261 add Upgrading
garrigue authored
37 is a more flexible version of the commuting label mode, allowing
341d6fc Typos
xleroy authored
38 one to omit labels in total applications. There is still a
cfdb261 add Upgrading
garrigue authored
39 -nolabels mode, but it does not allow non-optional labels in
40 applications (this was unsound).
41 To keep full compatibility with Objective Caml 2, labels were
42 removed from the standard libraries. Some labelized libraries are
43 kept as StdLabels (contains Array, List and String), MoreLabels
44 (contains Hashtbl, Map and Set), and UnixLabels.
45 Note that MoreLabels' status is not yet decided.
46
47 Q5: Why isn't there a ThreadUnixLabels module ?
48
49 A5: ThreadUnix is deprecated. It only calls directly the Unix module.
50
51 Q6: I was using commuting label mode, how can I upgrade ?
52
53 A6: The new behaviour is compatible with commuting label mode, but
54 standard libraries have no labels. You can add the following
55 lines at the beginning of your files (according to your needs):
56 open Stdlabels
57 open MoreLabels
58 module Unix = UnixLabels
59 Alternatively, if you already have a common module opened by
60 everybody, you can add these:
61 include StdLabels
62 include MoreLabels
63 module Unix = UnixLabels
64
65 You will then need to remove labels in functions from other modules.
66 This can be automated by using the scrapelabels tool, installed
67 in the Objective Caml library directory, which both removes labels
68 and inserts needed `open' clauses (see -help for details).
69 $CAMLLIB/scrapelabels -keepstd *.ml
70 or
71 $CAMLLIB/scrapelabels -keepmore *.ml
72 Note that scrapelabels is not guaranteed to be sound for commuting
73 label programs, since it will just remove labels, and not reorder
74 arguments.
75
76 Q7: I was using a few labels in classic mode, and now I get all these
77 errors. I just want to get rid of all these silly labels.
78
79 A7: scrapelabels will do it for you.
80 $CAMLLIB/scrapelabels [-all] *.ml
81 $CAMLLIB/scrapelabels -intf *.mli
82 You should specify the -all option only if you are sure that your
83 sources do not contain calls to functions with optional
84 parameters, as those labels would also be removed.
85
86 Q8: I was using labels in classic mode, and I was actually pretty fond
87 of them. How much more labels will I have to write now ? How can I
88 convert my programs and libraries ?
89
90 A8: The new default mode is more flexible than the original commuting
91 mode, so that you shouldn't see too much differences when using
92 labeled libraries. Labels are only compulsory in partial
93 applications (including the special case of function with an
5299fde Fusion des modifs faites sur la branche release jusqu'a la release 3.…
xleroy authored
94 unknown return type), or if you wrote some of them.
cfdb261 add Upgrading
garrigue authored
95
96 On the other hand, for definitions, labels present in the
97 interface must also be present in the implementation.
98 The addlabels tool can help you to do that. Suppose that you have
99 mymod.ml and mymod.mli, where mymod.mli adds some labels. Then
aab7cf7 clean up spaces and tabs
doligez authored
100 doing
cfdb261 add Upgrading
garrigue authored
101 $CAMLLIB/addlabels mymod.ml
102 will insert labels from the interface inside the implementation.
103 It also takes care of inserting them in recursive calls, as
104 the return type of the function is not known while typing it.
105
106 If you used labels from standard libraries, you will also have
107 problems with them. You can proceed as described in A6. Since you
108 used classic mode, you do not need to bother about changed
aab7cf7 clean up spaces and tabs
doligez authored
109 argument order.
Something went wrong with that request. Please try again.