Commit ca66ff18 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-05-04 22:56:22 by beppe] Started a page on references

Original author: beppe
Date: 2004-05-04 22:56:22+00:00
parent 65e4d166
......@@ -9,6 +9,7 @@
<include file="tutorial/overloading.xml"/>
<include file="tutorial/patterns.xml"/>
<include file="tutorial/errors.xml"/>
<include file="tutorial/references.xml"/>
<include file="tutorial/queries.xml"/>
<include file="tutorial/higherorder.xml"/>
<left>
......
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<page name="tutorial_references">
<title>References</title>
<left>
<boxes-toc/>
<p>
You can cut and paste the code on this page and
test it on the <a href="cgi-bin/cduce">online interpreter</a>.
</p>
</left>
<box title="Introduction" link="xpath">
<b style="color:#FF0080">TO BE DONE (for the moment see the user manual</b>
</box>
<box title="Advanced programming" link="sel">
<p>
The fact that reference types are encoded rather than primitives have some advantaes. Noteworthy is the fact that our encoding allows the programmer to modify the default beahvior of the <code>get</code> and <code>set</code> functions can be modified. So a programmer can define a reference that whenever is read, records the access in a log file, or it performs some sanity checks before performing a writing.
</p>
<p>
For instance ... (write some code here of the form
</p>
<sample><![CDATA[
let x =
let hidden = ref Int 0 in
{ get = %%some extra code%%; hidden.get ;
set = function (x:Int):[]
if %%some condition%%
then hidden.set(x)
else raise %%some exeption%%
}
]]></sample>
<p>
However use the encoding also cause some weirdness ...
<b style="color:#FF0080">TO BE DONE</b>
</p>
</box>
</page>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment