You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(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.
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
The text was updated successfully, but these errors were encountered: