[clean-list] I cannot use pst.ls

Peter Achten P.Achten at cs.ru.nl
Mon May 9 23:37:47 MEST 2011


Dear Ferreira,

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:
(1) as second argument of appListPIO
(2) by accessing the ls field of pst (using pst.ls)
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:

   doit [id1,id2] (lst,pst=:{ls})
     = (lst+1, appListPIO [(setControlText id1 (toString lst))
                          ,(setControlText id2 ls)
                          ] pst)

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.

Hope this helps.

Regards,
Peter


On 5/9/2011 5:02 PM, Ferreira Maurizio wrote:
> 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)
>
>
>
>
>
>
> -----------------------------------------------------------------------------
>
> 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.
>
>
>
> _______________________________________________
> clean-list mailing list
> clean-list at science.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/clean-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/clean-list/attachments/20110509/29ed6a27/attachment.html>


More information about the clean-list mailing list