Is it correct that patsopt creates .c file while the .dats file occurs type error?

This issue requires some thoughts.

Patsopt can be used to compile several DATS files into a single C file.
If Patsopt encounters a failure in the middle of a multi-file compilation,
deleting the entire file may not be a good choice.

Also, I want to point out that a program in ATS may be still unable to be
compiled into proper C code after the program passes typechecking.
Sometimes, one needs to go over the (partially) generated C code in order
to figure out what went wrong.On Monday, January 5, 2015 2:50:51 AM UTC-5, Kiwamu Okabe wrote:

Hi,

So, this issue is very serious.
Please imagine following Makefile.

https://github.com/metasepi/linux-bohai-s1/blob/bohai-s1/metasepi/scripts/Makefile.ats

https://github.com/metasepi/linux-bohai-s1/blob/bohai-s1/net/sunrpc/Makefile

If you enable “.SECONDARY: ${obj}/xdr_dats.c” line, then xdr_dats.c
file will not be removed while compiling.
Please imagine xdr.dats file includes some type error, then ATS2
compiler creates EMPTY xdr_dats.c file and remain it!
On next compile, you will find compile error on EMPTY xdr_dats.c file,
however true reason is at xdr.dats file’s error.
It’s messy…

On Sun, Jan 4, 2015 at 7:55 PM, Kiwamu Okabe <kiw…@debian.or.jp <javascript:>> wrote:

Is it correct that patsopt creates .c file while the .dats file occurs
type error?

$ rm -f hoge.c 
casper$ cat hoge.dats 
implement main0 (a) = println! ("Hello world!") 
casper$ patsopt -o hoge.c -d hoge.dats 
/home/kiwamu/tmp/hoge.dats: 11(line=1, offs=11) -- 48(line=1, 
offs=48): error(2): there is no suitable dynamic constant declared for 
[main0]. 
TRANS2: there are [1] errors in total. 
exit(ATS): uncaught exception: 

_2home_2kiwamu_2src_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)

casper$ ls -l hoge.c
-rw-r–r-- 1 kiwamu kiwamu 0 Jan 4 19:54 hoge.c


I think "hoge.c" should not be created on this case. 

Thank’s,

Kiwamu Okabe at METASEPI DESIGN

For the Makefile issue, I suppose one can work around it by compiling to a temporary file and moving to the real file if compilation succeeds (all in the same rule of course)> On Jan 5, 2015, at 10:49 AM, gmhwxi gmh...@gmail.com wrote:

This issue requires some thoughts.

Patsopt can be used to compile several DATS files into a single C file.
If Patsopt encounters a failure in the middle of a multi-file compilation,
deleting the entire file may not be a good choice.

Also, I want to point out that a program in ATS may be still unable to be
compiled into proper C code after the program passes typechecking.
Sometimes, one needs to go over the (partially) generated C code in order
to figure out what went wrong.

On Monday, January 5, 2015 2:50:51 AM UTC-5, Kiwamu Okabe wrote:
Hi,

So, this issue is very serious.
Please imagine following Makefile.

https://github.com/metasepi/linux-bohai-s1/blob/bohai-s1/metasepi/scripts/Makefile.ats https://github.com/metasepi/linux-bohai-s1/blob/bohai-s1/metasepi/scripts/Makefile.ats
https://github.com/metasepi/linux-bohai-s1/blob/bohai-s1/net/sunrpc/Makefile https://github.com/metasepi/linux-bohai-s1/blob/bohai-s1/net/sunrpc/Makefile

If you enable “.SECONDARY: ${obj}/xdr_dats.c” line, then xdr_dats.c
file will not be removed while compiling.
Please imagine xdr.dats file includes some type error, then ATS2
compiler creates EMPTY xdr_dats.c file and remain it!
On next compile, you will find compile error on EMPTY xdr_dats.c file,
however true reason is at xdr.dats file’s error.
It’s messy…

On Sun, Jan 4, 2015 at 7:55 PM, Kiwamu Okabe <kiw…@ <>debian.or.jp http://debian.or.jp/> wrote:

Is it correct that patsopt creates .c file while the .dats file occurs
type error?

$ rm -f hoge.c 
casper$ cat hoge.dats 
implement main0 (a) = println! ("Hello world!") 
casper$ patsopt -o hoge.c -d hoge.dats 
/home/kiwamu/tmp/hoge.dats: 11(line=1, offs=11) -- 48(line=1, 
offs=48): error(2): there is no suitable dynamic constant declared for 
[main0]. 
TRANS2: there are [1] errors in total. 
exit(ATS): uncaught exception: 
_2home_2kiwamu_2src_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025) 
casper$ ls -l hoge.c 
-rw-r--r-- 1 kiwamu kiwamu 0 Jan  4 19:54 hoge.c 

I think “hoge.c” should not be created on this case.

Thank’s,

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-user...@googlegroups.com mailto:ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com mailto:ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/c0ea7629-6dc7-4ff8-aaf4-4eda4a5e7111%40googlegroups.com https://groups.google.com/d/msgid/ats-lang-users/c0ea7629-6dc7-4ff8-aaf4-4eda4a5e7111%40googlegroups.com?utm_medium=email&utm_source=footer.

Yes, this would be a reasonable solution for the moment.

If one just uses patsopt to compile a single DATS file, then writing a
simple wrapper
around patsopt should be able to address the issue adequately.

My design for patsopt ensures that the closing of an opened file is
postponed until the last
possible moment. Instead of allowing an EMPTY file to be generated, I am
now thinking about
putting in it a directive like:

#error(patsopt: there were errors …)On Monday, January 5, 2015 6:32:10 AM UTC-5, Shea Levy wrote:

For the Makefile issue, I suppose one can work around it by compiling to a
temporary file and moving to the real file if compilation succeeds (all in
the same rule of course)

On Jan 5, 2015, at 10:49 AM, gmhwxi <gmh...@gmail.com <javascript:>> wrote:

This issue requires some thoughts.

Patsopt can be used to compile several DATS files into a single C file.
If Patsopt encounters a failure in the middle of a multi-file compilation,
deleting the entire file may not be a good choice.

Also, I want to point out that a program in ATS may be still unable to be
compiled into proper C code after the program passes typechecking.
Sometimes, one needs to go over the (partially) generated C code in order
to figure out what went wrong.

On Monday, January 5, 2015 2:50:51 AM UTC-5, Kiwamu Okabe wrote:

Hi,

So, this issue is very serious.
Please imagine following Makefile.

https://github.com/metasepi/linux-bohai-s1/blob/bohai-s1/metasepi/scripts/Makefile.ats

https://github.com/metasepi/linux-bohai-s1/blob/bohai-s1/net/sunrpc/Makefile

If you enable “.SECONDARY: ${obj}/xdr_dats.c” line, then xdr_dats.c
file will not be removed while compiling.
Please imagine xdr.dats file includes some type error, then ATS2
compiler creates EMPTY xdr_dats.c file and remain it!
On next compile, you will find compile error on EMPTY xdr_dats.c file,
however true reason is at xdr.dats file’s error.
It’s messy…

On Sun, Jan 4, 2015 at 7:55 PM, Kiwamu Okabe kiw...@debian.or.jp wrote:

Is it correct that patsopt creates .c file while the .dats file occurs
type error?

$ rm -f hoge.c 
casper$ cat hoge.dats 
implement main0 (a) = println! ("Hello world!") 
casper$ patsopt -o hoge.c -d hoge.dats 
/home/kiwamu/tmp/hoge.dats: 11(line=1, offs=11) -- 48(line=1, 
offs=48): error(2): there is no suitable dynamic constant declared for 
[main0]. 
TRANS2: there are [1] errors in total. 
exit(ATS): uncaught exception: 

_2home_2kiwamu_2src_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)

casper$ ls -l hoge.c
-rw-r–r-- 1 kiwamu kiwamu 0 Jan 4 19:54 hoge.c


I think "hoge.c" should not be created on this case. 

Thank’s,

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...@googlegroups.com <javascript:>.
To post to this group, send email to ats-l...@googlegroups.com
<javascript:>.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/c0ea7629-6dc7-4ff8-aaf4-4eda4a5e7111%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/c0ea7629-6dc7-4ff8-aaf4-4eda4a5e7111%40googlegroups.com?utm_medium=email&utm_source=footer
.

while the .dats file occurs type error?

That would be nice :slight_smile:

But it needs quite significant effort.

The input/output part of ATS2 should be modularized in the future. The work
can probably be combined with the effort to port ATS2 to Windows (not via
Cygwin).On Mon, Jan 5, 2015 at 5:42 PM, john skaller ska...@users.sourceforge.net wrote:

On 06/01/2015, at 8:58 AM, gmhwxi wrote:

My design for patsopt ensures that the closing of an opened file is
postponed until the last
possible moment.

Er … why leave any files open at all?

Save all the text into a buffer. Write the buffer in one go at the end.


john skaller
ska...@users.sourceforge.net
http://felix-lang.org

My design for patsopt ensures that the closing of an opened file is postponed until the last
possible moment.

Er … why leave any files open at all?

Save all the text into a buffer. Write the buffer in one go at the end.

john skaller
ska...@users.sourceforge.net
http://felix-lang.org

Instead of generating an empty file, patsopt now generates a file containing
one #error(…) directive if it encounters an error during typechecking,
When such
a file is compiled, the programmer is reminded of what went wrong. I will
probably
replace #error with something like PATSOPT_ERROR to make it easier for
searching.On Sunday, January 4, 2015 5:56:19 AM UTC-5, Kiwamu Okabe wrote:

Hi all,

Is it correct that patsopt creates .c file while the .dats file occurs
type error?

$ rm -f hoge.c 
casper$ cat hoge.dats 
implement main0 (a) = println! ("Hello world!") 
casper$ patsopt -o hoge.c -d hoge.dats 
/home/kiwamu/tmp/hoge.dats: 11(line=1, offs=11) -- 48(line=1, 
offs=48): error(2): there is no suitable dynamic constant declared for 
[main0]. 
TRANS2: there are [1] errors in total. 
exit(ATS): uncaught exception: 
_2home_2kiwamu_2src_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025) 

casper$ ls -l hoge.c 
-rw-r--r-- 1 kiwamu kiwamu 0 Jan  4 19:54 hoge.c 

I think “hoge.c” should not be created on this case.

Thank’s,

Kiwamu Okabe at METASEPI DESIGN