Commit 76add091 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-05-04 23:24:35 by beppe] Empty log message

Original author: beppe
Date: 2004-05-04 23:25:32+00:00
parent c0b9613d
...@@ -11,7 +11,7 @@ test it on the <a href="cgi-bin/cduce">online interpreter</a>. ...@@ -11,7 +11,7 @@ test it on the <a href="cgi-bin/cduce">online interpreter</a>.
</left> </left>
<box title="Introduction" link="xpath"> <box title="Introduction" link="xpath">
<b style="color:#FF0080">TO BE DONE (for the moment see the user manual</b> <b style="color:#FF0080">TO BE DONE (for the moment please consult the user manual)</b>
</box> </box>
...@@ -19,11 +19,16 @@ test it on the <a href="cgi-bin/cduce">online interpreter</a>. ...@@ -19,11 +19,16 @@ test it on the <a href="cgi-bin/cduce">online interpreter</a>.
<box title="Advanced programming" link="sel"> <box title="Advanced programming" link="sel">
<p> <p>
The fact that reference types are encoded rather than primitive brings some advantages. Among these it is noteworthy that thanks to the encoding 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. The fact that reference types are encoded rather than primitive brings some
advantages. Among these it is noteworthy that thanks to the encoding 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>
<p> <p>
For instance the following template program, shows a way to define a reference to an integer that whenver is read performs some extra code, while whenever is written performs some checks and may raise an exception: For instance the following template program, shows a way to define an integer reference <code>x</code> that whenver it is read executes some extra code, while whenever it is written performs some checks and possibly raises an exception:
</p> </p>
<sample><![CDATA[ <sample><![CDATA[
let x = let x =
...@@ -32,12 +37,12 @@ let x = ...@@ -32,12 +37,12 @@ let x =
set = fun (x :Int):[] = set = fun (x :Int):[] =
if %%some condition%% if %%some condition%%
then hidden.set(x) then hidden.set(x)
else raise %%some exeption%% else raise %%some exception%%
} }
]]></sample> ]]></sample>
<p> <p>
However use the encoding also cause some weirdness ... However use the encoding also causes some weirdnesses ...
<b style="color:#FF0080">TO BE DONE</b> <b style="color:#FF0080">TO BE DONE</b>
</p> </p>
</box> </box>
......
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