Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Hendrik Tews <tews@tcs.inf.tu-dresden.de>
To: caml-list@margaux.inria.fr
Subject: constructors for objects in ocaml
Date: Tue, 23 Jul 1996 17:12:40 +0200	[thread overview]
Message-ID: <9607231512.AA02896@ithif02.ithi> (raw)


Hi everybody,

it is possible to define something like a constructor in ocaml,
ie to add an expression to a class which is evaluated every time
an object is created?

I tried something like

class top arg as self =
  method create x = let _ = print_x
                    in x
  val x = self#create arg
end;;

but got an error saying, that self is unbound.

Bye,

Hendrik Tews





                 reply	other threads:[~1996-07-23 19:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9607231512.AA02896@ithif02.ithi \
    --to=tews@tcs.inf.tu-dresden.de \
    --cc=caml-list@margaux.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox