<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body text="#000000" bgcolor="#ffffff">
    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 &egrave; destinato esclusivamente al destinatario sopra indicato, il quale &egrave; l'unico autorizzato ad usarlo, copiarlo e, sotto la propria responsabilit&agrave;, diffonderlo. Chiunque ricevesse questo messaggio per errore o comunque lo leggesse senza esserne legittimato &egrave; avvertito che trattenerlo, copiarlo, divulgarlo, distribuirlo a persone diverse dal destinatario &egrave; severamente proibito, ed &egrave; 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>
  </body>
</html>