* Anonymous classes
@ 1999-02-18 19:12 William Chesters
0 siblings, 0 replies; only message in thread
From: William Chesters @ 1999-02-18 19:12 UTC (permalink / raw)
To: caml-list
Could we have anonymous classes, as a natural counterpart to
anonymous functions?
let x =
object
method foo = 17
end
in
...
They would sometimes be useful for specifying the little bits of `glue'
one needs to interface a library routine with one's current problem.
On the other hand maybe this kind of sugar isn't strictly
necessary, since I found this pretty easy to add with camlp4 :-),
using a dummy local module.
expr: LEVEL "simple"
[ [ "object"; cspo = OPT class_self_patt;
cf = class_structure; "end" ->
<:expr< let module Dummy__ =
struct
class c () = object $cspo$ $list:cf$ end ;
end
in
new Dummy__.c () >> ] ] ;
(except that the definitions of class_structure and class_self_patt
need to be copied from pa_o.ml)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-02-19 8:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-18 19:12 Anonymous classes William Chesters
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox