Left root inconsistently attributed
John van Groningen
johnvg@cs.kun.nl
Mon, 1 Mar 1999 17:53:10 +0100
>I have a pseudo-random generator I've been using for years in a variety
>of languages. There's stuff for random subsets and random permutations
>and so on, but it's based on Algorith AS 183 from the journal Applied
>Statistics. The state of this random number generator is a triple of
>16-bit integers.
>
>The package works fine when I declare
>
> :: RNG_State :== (Int, Int, Int)
>
>Trying to take advantage of Clean's annotations, I strengthened this to
>
> :: RNG_State :== (!Int, !Int, !Int)
>
>and that worked just fine. Next, I tried to make the whole thing
>single-threaded:
>
> :: RNG_State :== *(!Int, !Int, !Int)
>
>but I get the error message
>
> Error [as183.dcl,8,RNG_State]:
> left root inconsistently attributed
>
>I haven't the faintest idea what this means. I tried the only thing
>I could see on the "left", namely !Int, and the only inconsistency I
>could imagine (* somewhere and not elsewhere) and tried
>
> :: *RNG_State := *(!*Int, !*Int, !*Int)
>
>but stuff get the same error message.
When a '*' is used in (the right hand side of) a type synonym, the name of the type synonym should be prefixed with a '*'.
My compiler accepts:
:: *RNG_State :== *(!*Int, !*Int, !*Int)
You wrote ':=' in your definition instead of ':=='. If your compiler does not accept the definition without the typo, report this as a bug.
>My intention is that RNG states should be used in a single-threaded way,
>so when I take a random subset or something I'm not turning over lots
>of storage allocating new RNG states.
>
>If this _isn't_ the way to say it, what is?
You can do this with:
:: *RNG_State :== (!Int, !Int, !Int)
or:
:: *RNG_State :== *(!Int, !Int, !Int)
You probably do not want to make the Int's unique, because the primitive functions on Int (+,-,...) do not return *Int because of overloading.
John van Groningen