Awesome, thanks! Yet again my instincts to always initialize a variable 
lead me astray in ATS. :)

On Sunday, May 27, 2018 at 8:46:03 PM UTC-5, gmhwxi wrote:
>
> Or you can do something like:
>
> implement
> add1(n) =
> let
>   fun add1_( n: Option_vt(int), res: &Option_vt(int)? >> _ ) : void =
>   case+ n of
>   | ~None_vt() => res := None_vt()
>   | ~Some_vt(i) => res := Some_vt(i+1)
>
>   var res : Option_vt(int)?
>   val () = add1_(n,res)
> in
>   res
> end
>
>
> On Sun, May 27, 2018 at 9:37 PM, aditya siram <[email protected] 
> <javascript:>> wrote:
>
>> In my haste I didn't include the line number of the error but it points 
>> to 'res := Some_vt(i+1)'.
>>
>> On Sunday, May 27, 2018 at 8:23:20 PM UTC-5, Artyom Shalkhakov wrote:
>>>
>>> Hi Aditya,
>>>
>>> I guess you will need to free it?
>>>
>>> пн, 28 мая 2018 г., 7:19 aditya siram <[email protected]>:
>>>
>>>> Hi,
>>>> I have the following simplified version of assiging to a stack variable 
>>>> and am getting the following error:
>>>>
>>>> "linear component of the following type is abandoned: 
>>>> [S2Eapp(S2Ecst(option_vt0ype_bool_vtype); S2Eapp(S2Ecst(g0int_t0ype); 
>>>> [1]), 
>>>> S2Evar(b$8622$8623(14297)))]"
>>>>
>>>> I searched around and the only reference I see to this error is about 
>>>> using a global variable in a function scope. 
>>>>
>>>> Any help is appreciated.
>>>>
>>>> Thanks!
>>>> -deech
>>>> extern fun add1(
>>>>   n : Option_vt(int)
>>>> ) : Option_vt(int)
>>>>
>>>> implement add1(n) =
>>>>   let
>>>>     fun add1_( n:Option_vt(int), res: &Option_vt(int) >> Option_vt(int) 
>>>> ) : void =
>>>>       case+ n of
>>>>         | ~Some_vt(i) => res := Some_vt(i+1)
>>>>         | ~None_vt() => ()
>>>>     var res : Option_vt(int) = None_vt()
>>>>     val () = add1_(n,res)
>>>>   in
>>>>     res
>>>>   end
>>>>
>>>>
>>>> -- 
>>>> 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 [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at https://groups.google.com/group/ats-lang-users.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/ats-lang-users/e51eb3bb-a5cb-4615-a87b-f2aa275fc5a4%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/ats-lang-users/e51eb3bb-a5cb-4615-a87b-f2aa275fc5a4%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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/ats-lang-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ats-lang-users/ff7f85a7-7af2-4e57-8fbe-fe9ed80a20f5%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ats-lang-users/ff7f85a7-7af2-4e57-8fbe-fe9ed80a20f5%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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/1d9ee8d6-6b43-406c-b758-e8c2354818c2%40googlegroups.com.

Reply via email to