Version française
Home     About     Download     Resources     Contact us    
Browse thread
Metaprogramming features
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Hurt <bhurt@j...>
Subject: Re: [Caml-list] Metaprogramming features
Jon Harrop wrote:
> On Friday 03 October 2008 16:09:40 Dario Teixeira wrote:
>   
>> Hi,
>>
>>     
>>> I really wish that the basic features of metaocaml, namely
>>> .< >., .~ and .! were included in OCaml proper.  The many other
>>> experimental features of metaocaml could stay 'experimental',
>>> those are the 3 which are sorely needed.
>>>       
>> To those of us not familiar with MetaOcaml, could you give us
>> an overview of what these features mean and why they are so
>> special?
>>     
>
> MetaOCaml extends OCaml with three constructs that allow programs to generate, 
> compile and evaluate code at run time.
>
> Code is represented by the form:
>
>   .< 1 + 2 >.
>
> This may be executed using:
>
>   .! .< 1 + 2 >.
>
> Values may be injected into code using:
>
>   .< 1 + .~x >.
>
>   
I'm definitely missing something here.  How are the above examples 
different from:
let f () = 1 + 2;;
f ();;
let f x = 1 + x;;

?

This is a non-trivial question, as there is no clear delineation between 
data structures and executable code.

Brian