Re: Strange mismatch of equal terms

2020-10-12 Thread d4v3y_5c0n3s
The thread you linked me answered my problem perfectly.  Thanks, you are 
awesome!

On Monday, October 12, 2020 at 6:31:14 AM UTC-4 d4v3y_5c0n3s wrote:

> Thanks Ice, I thought that something may have been posted about this, but 
> I wasn't sure what to search for.  I'll check this out and post whether 
> this works or not.  But seriously, thank you!
>
> On Monday, October 12, 2020 at 4:02:55 AM UTC-4 ice.r...@gmail.com wrote:
>
>> or, in case if this URL is not reachable (seems like relative to my 
>> mailbox):
>> https://groups.google.com/g/ats-lang-users/c/V5LihCmnXKc
>>
>> пн, 12 окт. 2020 г. в 08:01, Dambaev Alexander :
>>
>>> Hi,
>>>
>>> check this topic:
>>>
>>> https://mail.google.com/mail/u/0/#category/forums/QgrcJHsBrnXTtpBcBJPBCfzSNNVXkQVSFQv
>>>
>>> пн, 12 окт. 2020 г. в 02:16, d4v3y_5c0n3s :
>>>
 Here's my problem:
 I'm encountering this weird error where the compiler is for some reason 
 telling me that I cannot produce an "asset_hndl" record type because it 
 expects a "fpath" type and I gave an "fpath" type.  I'm really baffled by 
 this, any help is appreciated.

 Here's my code:
 assume asset_hndl = [a:vtype] @{ path=fpath, asset_ptr=a, 
 timestamp=usint }
 assume fpath = Strptr1
 assume path_variable = @{ variable=fpath, mapping=fpath }

 fun P ( path: string ) : fpath = "sta#"
 fun asset_map_filename ( filename: fpath, pv: !path_variable ) : fpath 
 = "sta#"
 fun{a:vtype} asset_hndl_new ( path: !fpath, pv: !path_variable ) : 
 asset_hndl = "sta#"

 implement{a} asset_hndl_new ( path, pv ) = 
 (@{path=asset_map_filename(path, 
 pv), asset_ptr=the_null_ptr, timestamp=int_to_usint(0)}:asset_hndl)

 Here's the error:
 patscc -tcats /home/tmj90/Goldelish-Engine/source/g_asset.dats
 /home/tmj90/Goldelish-Engine/source/g_asset.dats: 651(line=28, 
 offs=45) -- 738(line=28, offs=132): error(3): the dynamic expression 
 cannot 
 be assigned the type [S2Eexi(a(8761); ; S2Etyrec(flt0; npf=-1; 
 path=S2Ecst(fpath), asset_ptr=S2Evar(a(8761)), timestamp=S2Ecst(usint)))].
 /home/tmj90/Goldelish-Engine/source/g_asset.dats: 651(line=28, 
 offs=45) -- 738(line=28, offs=132): error(3): mismatch of static terms 
 (tyleq):
 The actual term is: S2Ecst(fpath)
 The needed term is: S2Ecst(fpath)

 Let me know if you need any more information.

 -- 
 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/9c6a2031-519d-4ea7-8d45-dd66cb38dc7fn%40googlegroups.com
  
 
 .

>>>

-- 
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/9088779f-2fc2-4084-85b2-5e3fd77d8fd0n%40googlegroups.com.


Re: Strange mismatch of equal terms

2020-10-12 Thread d4v3y_5c0n3s
Thanks Ice, I thought that something may have been posted about this, but I 
wasn't sure what to search for.  I'll check this out and post whether this 
works or not.  But seriously, thank you!

On Monday, October 12, 2020 at 4:02:55 AM UTC-4 ice.r...@gmail.com wrote:

> or, in case if this URL is not reachable (seems like relative to my 
> mailbox):
> https://groups.google.com/g/ats-lang-users/c/V5LihCmnXKc
>
> пн, 12 окт. 2020 г. в 08:01, Dambaev Alexander :
>
>> Hi,
>>
>> check this topic:
>>
>> https://mail.google.com/mail/u/0/#category/forums/QgrcJHsBrnXTtpBcBJPBCfzSNNVXkQVSFQv
>>
>> пн, 12 окт. 2020 г. в 02:16, d4v3y_5c0n3s :
>>
>>> Here's my problem:
>>> I'm encountering this weird error where the compiler is for some reason 
>>> telling me that I cannot produce an "asset_hndl" record type because it 
>>> expects a "fpath" type and I gave an "fpath" type.  I'm really baffled by 
>>> this, any help is appreciated.
>>>
>>> Here's my code:
>>> assume asset_hndl = [a:vtype] @{ path=fpath, asset_ptr=a, 
>>> timestamp=usint }
>>> assume fpath = Strptr1
>>> assume path_variable = @{ variable=fpath, mapping=fpath }
>>>
>>> fun P ( path: string ) : fpath = "sta#"
>>> fun asset_map_filename ( filename: fpath, pv: !path_variable ) : fpath = 
>>> "sta#"
>>> fun{a:vtype} asset_hndl_new ( path: !fpath, pv: !path_variable ) : 
>>> asset_hndl = "sta#"
>>>
>>> implement{a} asset_hndl_new ( path, pv ) = (@{path=asset_map_filename(path, 
>>> pv), asset_ptr=the_null_ptr, timestamp=int_to_usint(0)}:asset_hndl)
>>>
>>> Here's the error:
>>> patscc -tcats /home/tmj90/Goldelish-Engine/source/g_asset.dats
>>> /home/tmj90/Goldelish-Engine/source/g_asset.dats: 651(line=28, offs=45) 
>>> -- 738(line=28, offs=132): error(3): the dynamic expression cannot be 
>>> assigned the type [S2Eexi(a(8761); ; S2Etyrec(flt0; npf=-1; 
>>> path=S2Ecst(fpath), asset_ptr=S2Evar(a(8761)), timestamp=S2Ecst(usint)))].
>>> /home/tmj90/Goldelish-Engine/source/g_asset.dats: 651(line=28, offs=45) 
>>> -- 738(line=28, offs=132): error(3): mismatch of static terms (tyleq):
>>> The actual term is: S2Ecst(fpath)
>>> The needed term is: S2Ecst(fpath)
>>>
>>> Let me know if you need any more information.
>>>
>>> -- 
>>> 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/9c6a2031-519d-4ea7-8d45-dd66cb38dc7fn%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>

-- 
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/8401fd42-2773-44d8-83ec-1834c673dd53n%40googlegroups.com.


Re: Strange mismatch of equal terms

2020-10-12 Thread Dambaev Alexander
or, in case if this URL is not reachable (seems like relative to my
mailbox):
https://groups.google.com/g/ats-lang-users/c/V5LihCmnXKc

пн, 12 окт. 2020 г. в 08:01, Dambaev Alexander :

> Hi,
>
> check this topic:
>
> https://mail.google.com/mail/u/0/#category/forums/QgrcJHsBrnXTtpBcBJPBCfzSNNVXkQVSFQv
>
> пн, 12 окт. 2020 г. в 02:16, d4v3y_5c0n3s :
>
>> Here's my problem:
>> I'm encountering this weird error where the compiler is for some reason
>> telling me that I cannot produce an "asset_hndl" record type because it
>> expects a "fpath" type and I gave an "fpath" type.  I'm really baffled by
>> this, any help is appreciated.
>>
>> Here's my code:
>> assume asset_hndl = [a:vtype] @{ path=fpath, asset_ptr=a, timestamp=usint
>> }
>> assume fpath = Strptr1
>> assume path_variable = @{ variable=fpath, mapping=fpath }
>>
>> fun P ( path: string ) : fpath = "sta#"
>> fun asset_map_filename ( filename: fpath, pv: !path_variable ) : fpath =
>> "sta#"
>> fun{a:vtype} asset_hndl_new ( path: !fpath, pv: !path_variable ) :
>> asset_hndl = "sta#"
>>
>> implement{a} asset_hndl_new ( path, pv ) = (@{path=asset_map_filename(path,
>> pv), asset_ptr=the_null_ptr, timestamp=int_to_usint(0)}:asset_hndl)
>>
>> Here's the error:
>> patscc -tcats /home/tmj90/Goldelish-Engine/source/g_asset.dats
>> /home/tmj90/Goldelish-Engine/source/g_asset.dats: 651(line=28, offs=45)
>> -- 738(line=28, offs=132): error(3): the dynamic expression cannot be
>> assigned the type [S2Eexi(a(8761); ; S2Etyrec(flt0; npf=-1;
>> path=S2Ecst(fpath), asset_ptr=S2Evar(a(8761)), timestamp=S2Ecst(usint)))].
>> /home/tmj90/Goldelish-Engine/source/g_asset.dats: 651(line=28, offs=45)
>> -- 738(line=28, offs=132): error(3): mismatch of static terms (tyleq):
>> The actual term is: S2Ecst(fpath)
>> The needed term is: S2Ecst(fpath)
>>
>> Let me know if you need any more information.
>>
>> --
>> 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/9c6a2031-519d-4ea7-8d45-dd66cb38dc7fn%40googlegroups.com
>> 
>> .
>>
>

-- 
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/CAHjn2Ky75r0z%3De9XXtc7WFcsDHxJ0k0bn%3DrnApj%3Dgd7V6kgTWA%40mail.gmail.com.


Re: Strange mismatch of equal terms

2020-10-12 Thread Dambaev Alexander
Hi,

check this topic:
https://mail.google.com/mail/u/0/#category/forums/QgrcJHsBrnXTtpBcBJPBCfzSNNVXkQVSFQv

пн, 12 окт. 2020 г. в 02:16, d4v3y_5c0n3s :

> Here's my problem:
> I'm encountering this weird error where the compiler is for some reason
> telling me that I cannot produce an "asset_hndl" record type because it
> expects a "fpath" type and I gave an "fpath" type.  I'm really baffled by
> this, any help is appreciated.
>
> Here's my code:
> assume asset_hndl = [a:vtype] @{ path=fpath, asset_ptr=a, timestamp=usint }
> assume fpath = Strptr1
> assume path_variable = @{ variable=fpath, mapping=fpath }
>
> fun P ( path: string ) : fpath = "sta#"
> fun asset_map_filename ( filename: fpath, pv: !path_variable ) : fpath =
> "sta#"
> fun{a:vtype} asset_hndl_new ( path: !fpath, pv: !path_variable ) :
> asset_hndl = "sta#"
>
> implement{a} asset_hndl_new ( path, pv ) = (@{path=asset_map_filename(path,
> pv), asset_ptr=the_null_ptr, timestamp=int_to_usint(0)}:asset_hndl)
>
> Here's the error:
> patscc -tcats /home/tmj90/Goldelish-Engine/source/g_asset.dats
> /home/tmj90/Goldelish-Engine/source/g_asset.dats: 651(line=28, offs=45)
> -- 738(line=28, offs=132): error(3): the dynamic expression cannot be
> assigned the type [S2Eexi(a(8761); ; S2Etyrec(flt0; npf=-1;
> path=S2Ecst(fpath), asset_ptr=S2Evar(a(8761)), timestamp=S2Ecst(usint)))].
> /home/tmj90/Goldelish-Engine/source/g_asset.dats: 651(line=28, offs=45)
> -- 738(line=28, offs=132): error(3): mismatch of static terms (tyleq):
> The actual term is: S2Ecst(fpath)
> The needed term is: S2Ecst(fpath)
>
> Let me know if you need any more information.
>
> --
> 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/9c6a2031-519d-4ea7-8d45-dd66cb38dc7fn%40googlegroups.com
> 
> .
>

-- 
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/CAHjn2KyAzPax%3D7q5a0qTctFGOy4rf0Z223Gg-yU1ov-YyqAGMw%40mail.gmail.com.


How to define array members in typedef?

2020-10-12 Thread Kiwamu Okabe
Dear all,

I wrote following code:

```ats
#include "share/atspre_define.hats"
#include "share/atspre_staload.hats"

#define MAXPATHLEN 1024

typedef kld_file_stat = @{ version = int, name = @[char][MAXPATHLEN]}

fun kern_kldstat {l:addr} (pf: !kld_file_stat @ l | p: ptr l): int = 0 where {
  val () = !p.name.[0] := 'A'
}

implement main0 () = {
}
```

But it causes following compile error:

```
$ patscc -D_GNU_SOURCE -DATS_MEMALLOC_LIBC main.dats -lpthread
main_dats.c:122:1: warning: parameter names (without types) in
function declaration
  122 | atstkind_t0ype(atstype_char) atstyarr_field(atslab__name) ;
  | ^~
In file included from main_dats.c:14:
/home/kiwamu/src/ATS-Postiats/ccomp/runtime/pats_ccomp_typedefs.h:176:31:
error: field ‘atstyarr_field_undef’ declared as a function
  176 | #define atstyarr_field(fname) atstyarr_field_undef(fname)
  |   ^~~~
main_dats.c:122:30: note: in expansion of macro ‘atstyarr_field’
  122 | atstkind_t0ype(atstype_char) atstyarr_field(atslab__name) ;
  |  ^~
main_dats.c:127:1: warning: parameter names (without types) in
function declaration
  127 | atstkind_t0ype(atstype_char) atstyarr_field(atslab__name) ;
  | ^~
In file included from main_dats.c:14:
/home/kiwamu/src/ATS-Postiats/ccomp/runtime/pats_ccomp_typedefs.h:176:31:
error: field ‘atstyarr_field_undef’ declared as a function
  176 | #define atstyarr_field(fname) atstyarr_field_undef(fname)
  |   ^~~~
main_dats.c:127:30: note: in expansion of macro ‘atstyarr_field’
  127 | atstkind_t0ype(atstype_char) atstyarr_field(atslab__name) ;
  |  ^~
In file included from main_dats.c:15:
main_dats.c: In function ‘kern_kldstat_0’:
/home/kiwamu/src/ATS-Postiats/ccomp/runtime/pats_ccomp_instrset.h:226:45:
error: ‘postiats_tyrec_0’ has no member named ‘atslab__name’
  226 | #define ATSSELfltrec(pmv, tyrec, lab) ((pmv).lab)
  | ^
/home/kiwamu/src/ATS-Postiats/ccomp/runtime/pats_ccomp_instrset.h:339:34:
note: in definition of macro ‘ATSINSstore’
  339 | #define ATSINSstore(pmv1, pmv2) (pmv1 = pmv2)
  |  ^~~~
main_dats.c:218:13: note: in expansion of macro ‘ATSSELarrptrind’
  218 | ATSINSstore(ATSSELarrptrind(ATSSELfltrec(ATSderef(arg0,
postiats_tyrec_0), postiats_tyrec_1, atslab__name),
atstkind_t0ype(atstype_char), [ATSPMVi0nt(0)]), ATSPMVchar('A')) ;
  | ^~~
main_dats.c:218:29: note: in expansion of macro ‘ATSSELfltrec’
  218 | ATSINSstore(ATSSELarrptrind(ATSSELfltrec(ATSderef(arg0,
postiats_tyrec_0), postiats_tyrec_1, atslab__name),
atstkind_t0ype(atstype_char), [ATSPMVi0nt(0)]), ATSPMVchar('A')) ;
  | ^~~~
make: *** [../../../../../../mk/ats2-fix.mk:2: all] Error 1
```

How to define array members in typedef using pure ATS language?
Or should we use the following idiom with C language?

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/TESTATS/fieldarr.dats#L20

Best regards,
-- 
Kiwamu Okabe at METASEPI DESIGN

-- 
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/CAEvX6dny%2BLS%2B4NDyGeon0j6VPPwKHATvsKFYOsT09ZD1rOEzUw%40mail.gmail.com.