Support in ATS for using external packages

85 views
Skip to first unread message

gmhwxi

unread,
Jan 3, 2017, 2:45:09 PM1/3/17
to ats-lang-users


######
#
# For the moment, I am using ats-lang-users for ats-lang-devel.
#
######

For people interested in this, please feel free to post your comments.

In the near future, I hope to set up a packaging system for ATS. It is
long overdue.

I looked around and tried npm (JS) and composer (PHP). For the moment,
I plan to use npm (but this choice should have minimal impact, if at all, on
the support for packaging system in ATS).

One can say that being explicit is a theme in the design of ATS. There is
no exception this time. A environment variable PATSHOMERELOCS is to
be introduced (which may or may not replace the variable PATSHOMERELOC
that is currently in use).

PATSHOMERELOCS is essentially a collection of paths separation by colon (:)
(or other characters).

Say that you have used npm to install a package FOO globally. Then you may have

/usr/local/lib/node_modules/
FOO

on your system.

Please make sure that /usr/local/lib/node_modules is one of the paths in PATSHOMERELOCS.

You may use FOO in your code in the following ways:

#include "${PATSHOMERELOCS}/FOO/foo.hats"
#staload "${PATSHOMERELOCS}/FOO/foo.sats"
#staload _ = "${PATSHOMELOCS}/FOO/foo.hats"

By mentioning PATSHOMERELOCS in a loading path is what I refer to as being explicit.

This should address the issue of compilation to C involving external packages. Obviously, we also
need to compile the generated C code into object files. This latter issue can be addressed by making
use of pkg-config properly. We just need some experiments and then form certain guidelines for doing it.

Cheers!


Steinway Wu

unread,
Jan 6, 2017, 1:14:44 PM1/6/17
to ats-lang-users
I just played with it on my ats-utils package. I published it here, https://www.npmjs.com/package/ats-utils so that others can try out. It is under MIT license. 

gmhwxi

unread,
Jan 8, 2017, 11:23:05 AM1/8/17
to ats-lang-users
I have added the support for PATSHOMERELOCS as is outlined
above. It will go into ATS2-0.3.0, which will be released shortly.

If you would like to try it now, please just download the GitHub version
of ATS2.

Cheers!

--Hongwei


On Tuesday, January 3, 2017 at 2:45:09 PM UTC-5, gmhwxi wrote:

Steinway Wu

unread,
Jan 19, 2017, 10:49:42 AM1/19/17
to ats-lang-users
It seems that the change breaks the build of ATS-Postiats-contrib. I can no longer compile atscc2js/2erl/2clj etc. It can not find source files any more and reporting errors like ".PATSRELOCROOT-$USER/SATS/json.sats is not available". 


On Tuesday, January 3, 2017 at 2:45:09 PM UTC-5, gmhwxi wrote:

Hongwei Xi

unread,
Jan 19, 2017, 11:24:34 AM1/19/17
to ats-lan...@googlegroups.com
Yes, there is a lot of moving around.

Please take a look at the scripts to see how these utils can be built:

https://github.com/ats-lang/ats-lang.github.io/tree/master/SCRIPT

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/81f2487f-2dd2-49d3-827e-19eb3ec0b662%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages