-
Notifications
You must be signed in to change notification settings - Fork 0
/
2002.11.19.txt
196 lines (141 loc) · 5.77 KB
/
2002.11.19.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
Hello,
Here is the latest Caml Weekly News, week 12 to 19 November, 2002.
1) exuberant ctags for ocaml
2) Aqua (non-X) labltk on Mac OS 10
3) The need for opcode GRAB?
4) Even at compile time 2*2=4!
======================================================================
1) exuberant ctags for ocaml
----------------------------------------------------------------------
Alan Schmitt asked:
I was wondering if someone uses exuberant ctags with ocaml ...
Michal Moskal answered:
I'm using OCaml-otags, that, with little patche, works very nice
with vi. Another patch is need to compile it with ocaml 3.05+.
You can find the patches in question in:
ftp://ftp.nest.pld.org.pl/test/SRPMS/ocaml-otags-3.04.3-2.src.rpm
(or in cvs.pld.org.pl).
and Cuihtlauac Alvarado announced:
Latest release :
http://perso.wanadoo.fr/cuihtlauac.alvarado/otags-3.06.5.tar.gz
vi & stdout patches should be ok.
======================================================================
2) Aqua (non-X) labltk on Mac OS 10
----------------------------------------------------------------------
Trevor Jim explained:
I managed to get labltk working in Mac OS 10 with the Aqua (non-X)
version of Tk. It's a bit clunky but maybe someone who knows more
about these things can clean it up.
Here's how it goes:
(see the rest of this long message at
http://caml.inria.fr/archives/200211/msg00163.html)
======================================================================
3) The need for opcode GRAB?
----------------------------------------------------------------------
Blair Zajac asked and Alan Schmitt shamelessly suggested:
> What is the grab/restart trick? Is there a URL to an explanation?
>
> I didn't find anything definitive through Google.
>
> Best,
> Blair
A long time ago, in a research building far far away, Didier Le Botlan
and me started a small project to explain how ocaml worked, under the
hood. We haven't done anything about for a long time, and it's barely
started but if you want to have a look, here are the html pages:
http://pauillac.inria.fr/~lebotlan/docaml_eng.html
And if anyone wants to contribute, I'd be glad to restart the project.
The sourceforge project page is at:
http://www.sf.net/projects/docaml/
======================================================================
4) Even at compile time 2*2=4!
----------------------------------------------------------------------
Jakob Lichtenberg wondered:
Fellow O'Caml hackers,
I have this complicated module 'fourLib.ml' that binds the value 'four' to
the *computed* value of four:
---
let four = (Printf.printf "Now we do the complicated calculation of
2*2...\n";
let res = 2*2
in res);
---
A sample application 'sixteen.ml':
---
let _ = Printf.printf "4 * 4 is %d" (FourLib.four * FourLib.four);
---
I wish to package/compile my 'fourLib' so that I can avoid doing the
complicated calculation '2*2' each and every time I load 'fourLib'. (I am
sure that you can imagine an even more requiring computational task than
evaluating '2*2'.)
Currently I build as follows:
> ocamlc -c fourLib.ml
> ocamlc -c sixteen.ml
> ocamlc -o sixteen fourLib.cmo sixteen.cmo
Unfortunately 2*2 is first calculated when I run the application:
> ./sixteen
Now we do the complicated calculation of 2*2...
4 * 4 is 16
---
1. I am willing to rewrite the library, the way stuff is build, etc.... I
basically just want ocaml to evaluate 2*2 before the final linking. Is my
only hope to serialize Four.four and then load it?
2. Can I build a new top-level interactive environment 'ocaml_with_fourLib'
where this module is 'pre-loaded'. Again, the actual calculation of 2*2
should be done when I build ocaml_with_fourLib - not when I start it.
Alessandro Baretta answered:
I wish to suggest one possibility.
1) You write a module defining the type of the datastructure
you wish to precompute and load
2) You write a program importing the above module, which
computes the datastructure and marshals it to a file. You
run this program.
3) You write a library which, upon being loaded, searches
the filesystem for the appropriate file, unmarshals it and
binds the precomputed data to an identifier.
4) You write your programs referring to the the identifier
exported by #3.
eg.
module: type_of_four.ml
*********************
type four = int
module: compute_four.ml
**********************
open Type_of_four
let four:four = 2 * 2
let _ = Marshal.to_channel (open_out "foo") four []
module: four.ml
***************
open Type_of_four
let (four:four) = Marshal.from_channel (open_in "foo")
module: sixteen.ml
******************
open Four
let sixteen = four * four
Daniel de Rauglaudre answered as well:
There is no difference between "load" a module and "start" it: the fact
of loading it is starting it.
In some cases, you could resolve your problem with Camlp4, if your
computation can be done at parse time. We can imagine a syntax
extension, e.g. "compute" followed by an expression, ask the
preprocessor to evalutate it and build the syntax tree of the
result. For example:
compute (2*2)
would generate at parse time:
4
But this could not work:
let x = 2 in
compute(x*x)
because the preprocessor does not know what is "x".
On the other hand, if "x" is defined as a directive to the preprocessor,
for example with "DEFINE x = 2" (new syntax extension pa_macro.cmo), it
could work.
======================================================================
Old cwn
----------------------------------------------------------------------
If you happen to miss a cwn, you can send me a message
([email protected]) and I'll mail it to you, or go take a look at
the archive (http://pauillac.inria.fr/~aschmitt/cwn/). If you also wish
to receive it every week by mail, just tell me so.
======================================================================
Alan Schmitt