But it's not a const reference for any reason I can see!

On Thu, Mar 24, 2011 at 1:53 PM, Pal Engstad <[email protected]>wrote:

> That makes the discussion more sensible to me, thanks!
>
> Well, the problem is akin to using a pointer as an argument to a function
> accepting a const-pointer (in C++), which is an error. I would expect BitC
> to be at least as stringent!
>
>     chain = S(4, &container.s)      //  chain-->[4, *]---->[5, null]
>                          ~~~~~~~~
>                          Type Error: Can't initialize a const reference
> with a mutable reference.
>
> PKE
>
> ________________________________________
> From: [email protected] [[email protected]] On
> Behalf Of Jonathan S. Shapiro [[email protected]]
> Sent: Thursday, March 24, 2011 1:46 PM
> To: Discussions about the BitC language
> Subject: Re: [bitc-dev] Mutability, again
>
>  Pal:
>
> It was *critical* to the example that the 's' field in the container was
> *not* a reference field and therefore not a nullable field. Your analysis
> relies on changing that type in a way that breaks the example.
>
> However, there is a further syntactic problem in the example. /container/
> is a reference, so it might have been clearer if I had written it as
>
>  let container = Container(S(5, null))  //  container-->[5, null]
>     chain = S(4, &container.s)      //  chain-->[4, *]---->[5, null]
>     len = S_length(chain)              // returns 2 :
>  in
>    container.s := S(6,S(7,null))       //  container-->[6, *]-->[7, null]
>                                        //  chain-->[4, *]-->[6,*] -->[5,
> null]
>
> Note the addition of the '&' in the initialization of chain. My intention
> is that this is capturing an inner reference, not a pointer.
>
>
> shap
>
>  _______________________________________________
> bitc-dev mailing list
> [email protected]
> http://www.coyotos.org/mailman/listinfo/bitc-dev
>
>
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to