I'm not clear on what exactly const and mutable means here, but shouldn't that 
be two type errors? 

struct S
is
  const i : int32
  const next nullable S

boxed struct Container
is
  mutable s : S;

def S_length(s : S)
in
   case tmp = s in
   null => 0:int32
   otherwise => 1 + S_length(s.next);

def f()
in
  let container = Container(S(5, null))
      chain = S(4, container.s)
                           ~~~~~~~         
                           Type Error: container.s is mutable, but argument 2 
in the constructor is const.

      len = S_length(chain)
  in
     container.s.next = S(6,S(7,null))
     ~~~~~~~~~~~~~~~~~~~~
     Type Error: Trying to mutate a const struct member.    
     ...



_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to