Thank you for the help.  That makes sense, I just wanted to make sure I 
understood the problem for the future.

On Friday, January 22, 2021 at 8:30:07 AM UTC-5 gmhwxi wrote:

> (x:  &int >> _) means that the argument is call-by-reference; the integer 
> in it may be updated.
>
> BTW, (x: &int) means that the argument is read-only call-by-reference, but 
> it is not enforced in ATS2
>
> Note that (&T >> _) is just a shorthand for (&T >> T).
>
>
>
> On Fri, Jan 22, 2021 at 8:24 AM d4v3y_5c0n3s <tmj...@gmail.com> wrote:
>
>> Thanks, this works perfectly!  By the way, what does the "&int >>  _" 
>> syntax mean in this case?
>>
>> On Friday, January 22, 2021 at 1:46:15 AM UTC-5 gmhwxi wrote:
>>
>>> There are a couple of issues. Maybe the following code is what
>>> you wanted:
>>>
>>> fn chng_int_test ( i: &int >> _ ) : void = i := i + 1
>>>
>>>
>>> fn test_chnge () : int = let
>>>   var i: int = 0
>>>
>>>   val () = chng_int_test(i)
>>> in
>>>   i
>>> end
>>> On Fri, Jan 22, 2021 at 12:51 AM d4v3y_5c0n3s <tmj...@gmail.com> wrote:
>>>
>>>> I'm trying to use call by reference in the following example, but I'm 
>>>> running into issues trying to get it to compile.  It's late, so I'll 
>>>> explain more tomorrow, but any help is appreciated.
>>>>
>>>> fn chng_int_test ( i: &int? >> _ ) : void = i + 1
>>>>
>>>> fn test_chnge () : int = let
>>>>     var i = 0
>>>>     val () = chng_int_test(i)
>>>> in
>>>>     i
>>>> end
>>>>
>>>> /tmp/patsopt_tcats_SwYDb2: 46(line=2, offs=45) -- 47(line=2, offs=46): 
>>>> error(3): the dynamic expression cannot be assigned the type 
>>>> [S2Eapp(S2Ecst(g1uint_int_t0ype); S2Eextkind(atstype_size), S2EVar(0))].
>>>> /tmp/patsopt_tcats_SwYDb2: 46(line=2, offs=45) -- 47(line=2, offs=46): 
>>>> error(3): mismatch of static terms (tyleq):
>>>> The actual term is: S2Etop(knd=0; S2Eapp(S2Ecst(g0int_t0ype); 
>>>> S2Eextkind(atstype_int)))
>>>> The needed term is: S2Eapp(S2Ecst(g1uint_int_t0ype); 
>>>> S2Eextkind(atstype_size), S2EVar(0))
>>>> /tmp/patsopt_tcats_SwYDb2: 46(line=2, offs=45) -- 51(line=2, offs=50): 
>>>> error(3): the linear dynamic variable [i$view$74(-1)] is preserved but 
>>>> with 
>>>> an incompatible type.
>>>> /tmp/patsopt_tcats_SwYDb2: 46(line=2, offs=45) -- 51(line=2, offs=50): 
>>>> error(3): mismatch of static terms (tyleq):
>>>> The actual term is: S2Etop(knd=0; S2Eapp(S2Ecst(g0int_t0ype); 
>>>> S2Eextkind(atstype_int)))
>>>> The needed term is: S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int))
>>>> /tmp/patsopt_tcats_SwYDb2: 46(line=2, offs=45) -- 51(line=2, offs=50): 
>>>> error(3): mismatch of static terms (tyleq):
>>>> The actual term is: S2Eat(S2Etop(knd=0; S2Eapp(S2Ecst(g0int_t0ype); 
>>>> S2Eextkind(atstype_int))); S2Evar(i(4314)))
>>>> The needed term is: S2Eat(S2Eapp(S2Ecst(g0int_t0ype); 
>>>> S2Eextkind(atstype_int)); S2Evar(i(4314)))
>>>> /tmp/patsopt_tcats_SwYDb2: 46(line=2, offs=45) -- 51(line=2, offs=50): 
>>>> error(3): the dynamic expression cannot be assigned the type 
>>>> [S2Ecst(atsvoid_t0ype)].
>>>> /tmp/patsopt_tcats_SwYDb2: 46(line=2, offs=45) -- 51(line=2, offs=50): 
>>>> error(3): mismatch of static terms (tyleq):
>>>> The actual term is: S2Eapp(S2Ecst(g1uint_int_t0ype); 
>>>> S2Eextkind(atstype_size), S2Eapp(S2Ecst(add_int_int); S2EVar(0), 
>>>> S2Eintinf(1)))
>>>> The needed term is: S2Ecst(atsvoid_t0ype)
>>>> /tmp/patsopt_tcats_SwYDb2: 78(line=4, offs=26) -- 138(line=9, offs=4): 
>>>> error(3): the linear dynamic variable [i$view$75(-1)] is preserved but 
>>>> with 
>>>> an incompatible type.
>>>> /tmp/patsopt_tcats_SwYDb2: 78(line=4, offs=26) -- 138(line=9, offs=4): 
>>>> error(3): mismatch of static terms (tyleq):
>>>> The actual term is: S2Eapp(S2Ecst(g0int_t0ype); S2Eextkind(atstype_int))
>>>> The needed term is: S2Eapp(S2Ecst(g1int_int_t0ype); 
>>>> S2Eextkind(atstype_int), S2Eintinf(0))
>>>> /tmp/patsopt_tcats_SwYDb2: 78(line=4, offs=26) -- 138(line=9, offs=4): 
>>>> error(3): mismatch of static terms (tyleq):
>>>> The actual term is: S2Etop(knd=0; S2Eapp(S2Ecst(g0int_t0ype); 
>>>> S2Eextkind(atstype_int)))
>>>> The needed term is: S2Etop(knd=0; S2Eapp(S2Ecst(g1int_int_t0ype); 
>>>> S2Eextkind(atstype_int), S2Eintinf(0)))
>>>> /tmp/patsopt_tcats_SwYDb2: 78(line=4, offs=26) -- 138(line=9, offs=4): 
>>>> error(3): mismatch of static terms (tyleq):
>>>> The actual term is: S2Eat(S2Etop(knd=0; S2Eapp(S2Ecst(g0int_t0ype); 
>>>> S2Eextkind(atstype_int))); S2Evar(i(4313)))
>>>> The needed term is: S2Eat(S2Etop(knd=0; S2Eapp(S2Ecst(g1int_int_t0ype); 
>>>> S2Eextkind(atstype_int), S2Eintinf(0))); S2Evar(i(4313)))
>>>> patsopt(TRANS3): there are [4] errors in total.
>>>> exit(ATS): uncaught exception: 
>>>> _2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "ats-lang-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to ats-lang-user...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/ats-lang-users/b7580da8-275c-4d17-b796-90e81404ee5dn%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/ats-lang-users/b7580da8-275c-4d17-b796-90e81404ee5dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "ats-lang-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ats-lang-user...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ats-lang-users/67c75864-2a19-4035-8c9d-33e66ca1797fn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ats-lang-users/67c75864-2a19-4035-8c9d-33e66ca1797fn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/23815c19-2bde-4f7f-b6f5-a485331ae2a6n%40googlegroups.com.

Reply via email to