caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jeremy Cowgar <jeremy@cowgar.com>
To: caml-list@yquem.inria.fr
Subject: Passing class type as parameter?
Date: Wed, 13 Sep 2006 14:58:24 -0400	[thread overview]
Message-ID: <D2466E0B-332C-4733-82AF-DF701C5C97AE@cowgar.com> (raw)

Can I do something like:

class base_model = object(self)
   method from_array ary = ...
end ;;

class user = object(self)
   inherit base_model
   ...
end ;;

let finder sql class_type =
   query_database sql ;
   let res = new class_type in
     res#from_array res ;;

let users = finder "SELECT * FROM users" user in
   xxx yyy ;;

Ok. That is not working code, prob has syntax errors as well, but you  
get my idea. The problem I am having is passing the class to the  
generic finder method.

Thanks,

Jeremy


             reply	other threads:[~2006-09-13 18:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-13 18:58 Jeremy Cowgar [this message]
2006-09-14  0:00 ` [Caml-list] " Jacques Garrigue

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=D2466E0B-332C-4733-82AF-DF701C5C97AE@cowgar.com \
    --to=jeremy@cowgar.com \
    --cc=caml-list@yquem.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;
as well as URLs for NNTP newsgroup(s).