<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Messaggio</title>
<meta content="MSHTML 6.00.2900.6082" name="GENERATOR">
</head>
<body text="#000000" bgcolor="#ffffff">
<div><font face="Arial" color="#0000ff" size="2"><span class="455481412-10052011">Thank you very much.</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span class="455481412-10052011">Your suggestion works perfectly.</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span class="455481412-10052011">I think I have more things to learn about uniqueness ...</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span class="455481412-10052011">Best regards.</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span class="455481412-10052011">Maurizio.</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span class="455481412-10052011"></span></font> </div>
<div><font face="Arial" color="#0000ff" size="2"><span class="455481412-10052011"></span></font> </div>
<div><font face="Arial" color="#0000ff" size="2"><span class="455481412-10052011"></span></font> </div>
<blockquote style="MARGIN-RIGHT: 0px">
<div></div>
<div class="OutlookMessageHeader" lang="it" dir="ltr" align="left"><font face="Tahoma" size="2">-----Messaggio originale-----<br>
<b>Da:</b> Peter Achten [mailto:P.Achten@cs.ru.nl] <br>
<b>Inviato:</b> lunedì 9 maggio 2011 23.38<br>
<b>A:</b> Ferreira Maurizio<br>
<b>Cc:</b> clean-list@science.ru.nl<br>
<b>Oggetto:</b> Re: [clean-list] I cannot use pst.ls<br>
<br>
</font></div>
Dear Ferreira,<br>
<br>
Any compiler error message that involves the keyword 'uniqueness' has to do with sharing: in your code, the function doit creates two references to the value pst:<br>
(1) as second argument of appListPIO<br>
(2) by accessing the ls field of pst (using pst.ls)<br>
This implies that it is not 'unique', i.e.: there exists no longer a single reference to the value pst. However, the function doit must produce a value of the same type that has exactly one reference. This is what the error message says: the demanded (uniqueness)
attribute (which is unique) cannot be offered by shared object (viz. pst). The trick to get around this is to use argument pattern-matching on (unique) records. The following should work:<br>
<pre wrap=""> doit [id1,id2] (lst,pst=:{ls})
= (lst+1, appListPIO [(setControlText id1 (toString lst))
,(setControlText id2 ls)
] pst)
</pre>
The difference is that now there is only a single reference to pst in the result of doit. The reference to ls is now directly 'into' the pst record, not via the pst record.<br>
<br>
Hope this helps.<br>
<br>
Regards,<br>
Peter<br>
<br>
<br>
On 5/9/2011 5:02 PM, Ferreira Maurizio wrote:
<blockquote cite="mid:E89B74EF2DA1894882807F197A1212220C69876C5B@itgoa00ms-020.selingdom.local" type="cite">
<pre wrap="">In the following test, I cannot use pst.ls
I suppose it should be the value used to initialize the process state (e.g. "ps")
The compiler complains about "setControlText id2 pst.ls" (near the end of the program)
whith the error:
Uniqueness error [hello.icl,27,pst]" demanded attribute cannot be offered by shared object
Any suggestion ?
(BTW, is there somewhere an explanation of error messages ?)
Regards.
Maurizio.
module hello
import StdEnv, StdIO
Start world
#(ids,world) = openIds 2 world
= startIO NDI "ps" (snd o openDialog 1 (hello ids) ) [ProcessClose closeProcess] world
where
hello [id1,id2] = Dialog "My dialog"
(TextControl "00" [ControlId id1]
:+:
TextControl "00" [ControlPos (Left, zero), ControlId id2]
:+:
ButtonControl "ok" [ ControlPos (Left, zero)
, ControlViewSize {w=75, h=23}
, ControlFunction (doit [id1,id2])
]
)
[ WindowClose (noLS closeProcess)
, WindowViewSize {w=150, h=90}
, WindowPos (Fix, OffsetVector {vx=400, vy=350})
]
doit [id1,id2] (lst,pst)
= (lst+1, appListPIO [(setControlText id1 (toString lst))
,(setControlText id2 pst.ls)
] pst)
</pre>
<pre wrap=""><fieldset class="mimeAttachmentHeader"></fieldset>
-----------------------------------------------------------------------------
Il presente messaggio, corredato dei relativi allegati, contiene informazioni da considerarsi strettamente riservate ed è destinato esclusivamente al destinatario sopra indicato, il quale è l'unico autorizzato ad usarlo, copiarlo e, sotto la propria responsabilità, diffonderlo. Chiunque ricevesse questo messaggio per errore o comunque lo leggesse senza esserne legittimato è avvertito che trattenerlo, copiarlo, divulgarlo, distribuirlo a persone diverse dal destinatario è severamente proibito, ed è pregato di rinviarlo immediatamente al mittente distruggendone l'originale.
This message, together with its annex(es), contains information to be deemed strictly confidential and is destined only to the addressee(s) identified above who only may use, copy and, under his/their responsibility, further disseminate it. If anyone received this message by mistake or reads it without entitlement is forewarned that keeping, copying, disseminating or distributing this message to persons other than the addressee(s) is strictly forbidden and is asked to transmit it immediately to the sender and to erase the original message received.
</pre>
<pre wrap=""><fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
clean-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:clean-list@science.ru.nl">clean-list@science.ru.nl</a>
<a class="moz-txt-link-freetext" href="http://mailman.science.ru.nl/mailman/listinfo/clean-list">http://mailman.science.ru.nl/mailman/listinfo/clean-list</a>
</pre>
</blockquote>
<br>
<br>
------------------------------------------------------------------------------------------
<br>
Email secured by Selesta Ingegneria Check Point System <br>
------------------------------------------------------------------------------------------
<br>
<br>
</blockquote>
<font face="monospace"><br>
<br>
-----------------------------------------------------------------------------<br>
<br>
Il presente messaggio, corredato dei relativi allegati, contiene informazioni da considerarsi strettamente riservate ed è destinato esclusivamente al destinatario sopra indicato, il quale è l'unico autorizzato ad usarlo, copiarlo e, sotto la propria responsabilità, diffonderlo. Chiunque ricevesse questo messaggio per errore o comunque lo leggesse senza esserne legittimato è avvertito che trattenerlo, copiarlo, divulgarlo, distribuirlo a persone diverse dal destinatario è severamente proibito, ed è pregato di rinviarlo immediatamente al mittente distruggendone l'originale. <br>
<br>
<br>
This message, together with its annex(es), contains information to be deemed strictly confidential and is destined only to the addressee(s) identified above who only may use, copy and, under his/their responsibility, further disseminate it. If anyone received this message by mistake or reads it without entitlement is forewarned that keeping, copying, disseminating or distributing this message to persons other than the addressee(s) is strictly forbidden and is asked to transmit it immediately to the sender and to erase the original message received.<br>
</font></body>
</html>