From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: farr@mit.edu
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Object Attribute Accessor Syntax Extension
Date: Thu, 24 Mar 2005 17:13:22 +0900 (JST) [thread overview]
Message-ID: <20050324.171322.41200116.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <eb565b700ace2c0c96303c31515066f4@mit.edu>
> I think it would be nice to have accessor functions defined
> automatically for simple datatypes (sort of a simplified version of the
> :accessor q properties of a data member in CLOS -- Ruby does something
> like this with its :attr_accessor a,b,c notes in the class definiton,
> too, and Python probably has something similar). The sytax I was
> thinking of using was:
>
> class body (m : float) (qq : float array) (pp : float array) =
> object
> val mutable accessor m = m
> val reader q = qq
> val reader p = pp
> val writer f = Array.make (Array.length pp) 0.0
> (* etc *)
> end
Looks nice. I actually wrote the same extension (with the same names)
experimentally in the yacc grammar last year. Having it in camlp4
would be more modular.
Note that in a yacc grammar your syntax would require "reader" and
"writer" to be keywords, but it may be OK with camlp4.
It may also be nice to have another small extension, so that
o#f <- expr
would be handled as
o#set_f <- (expr)
Jacques Garrigue
next prev parent reply other threads:[~2005-03-24 8:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-23 20:00 Will M. Farr
2005-03-24 8:13 ` Jacques Garrigue [this message]
2005-03-24 9:00 ` [Caml-list] " Alex Baretta
2005-03-24 10:33 ` 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=20050324.171322.41200116.garrigue@math.nagoya-u.ac.jp \
--to=garrigue@math.nagoya-u.ac.jp \
--cc=caml-list@yquem.inria.fr \
--cc=farr@mit.edu \
/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