1. 10
  1.  

  2. 2

    The fact that ATS makes heavy use of the C preprocessor bothers me. Does it have a true module system? Is there a particular reason it doesn’t?

    1. 5

      What use of the C preprocessor are you seeing? Is it the #include? That does work like C’s #include but there are more module like things. See staload. These respect namespacing and local definitions so you can do things like:

      local
        staload FOO = "somefile.sats"
      in
        $FOO.dosomething()
      end
      
      1. 1

        Yes, the include specifically made me think so. Is that actually the CPP? Anyways, reassuring to see there’s other functionality.

        1. 3

          No, the #include isn’t handled by the CPP. The C preprocessor is only used if you use #include/#define inside embedded C code blocks:

          %{
          #include <foo.h>
          #define X
          ...C Code here...
          %}
          
          1. 1

            Interesting! Seeing as the #include syntax is reused, is it textual substitution or something more complex?

            1. 3

              #include in ATS code is textual substitution in ATS code and the code processed by the ATS compiler. Anything in C code blocks is directly inserted into the generated C code (ATS compiles to C which is then compiled by a C compiler) so is handled by the C compiler. ATS doesn’t parse that code. So there are two languages at play there, both using #include for similar functionality.

    2. 1

      Great to see folks using this language- I’ve had my eyes on it for some time, but haven’t tried it out yet.

      Is the book available in text or Epub format?

      1. 2

        Not yet as far as I can tell. The other ATS documents are available in PDF and epub.