Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[patch] pa_macro: support for a "NOTHING" macro; expand function expressions. #8351

Closed
vicuna opened this issue Oct 31, 2003 · 1 comment
Closed

Comments

@vicuna
Copy link

vicuna commented Oct 31, 2003

Original bug ID: 1908
Reporter: administrator
Status: closed
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Monitored by: nogin

Bug description

Full_Name:
Version:
OS:
Submission from: charter-182-203.caltech.edu (131.215.182.203)

(1) When defining things with macros, it is very useful to be able to have
function applications in macro body that would have different arities in
different instances of the macro. Here is an example:

DEFINE MAP (name, param1, param2) = function
[] -> []
| (a,b) :: tl -> f param1 param2 :: name f tl

let rec iter1 f =
MAP(iter1, a, NOTHING)

let rec iter2 f =
MAP(iter2, a, b)

would define functions of the following types:

iter1: ('a -> 'c) -> ('a * 'b) list -> 'c list
iter2: ('a -> 'b -> 'c) -> ('a * 'b) list -> 'c list

(2) Currently, pa_macro does not expand macro parameters in function
epressions.

I wrote a patch that implements the "NOTHING" keyword (it allows both defining a
macro to = NOTHING and passing NOTHING as argument to an existing macro) -
http://nogin.org/patches/ocaml-3.07-macro-nothing.patch . It also makes sure
that macro parameters are properly substituted for in function expressions, and
in patters.

Note that the above patch is supposed to go on top of the five other pa_macro
patches I've submitted (#1901, #1902, #1904, #1905, and #1907). The end result
(pa_macro with all the patches applied) is also available on our CVS - please
see http://cvs.metaprl.org:12000/cvsweb/metaprl/util/Attic/pa_macro.ml?only_with_tag%3Docaml_3_07

@vicuna
Copy link
Author

vicuna commented Jun 29, 2004

Comment author: administrator

Fixed 2). Not convinced with 1).
MM, 2004-06-29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant