After reading and re-reading your message, I think that what you need is 
some kind of extension of ATS.

>> It's a big pile of questions, I just want to know if learning ATS could 
make those features possible. 

I feel that ATS and these programming features are kind of orthogonal. 

Say you want some code in a language called XYZ. For instance, XYZ can be 
C, Javascript or some assembly.
You can build a compiler from ATS to XYZ so that *some* (not all) code in 
XYZ that you need can be generated
from ATS source. By taking such an approach, you get the chance to use the 
type system of ATS to flush out a
large variety of potential bugs in your code. Also, the hope is that you 
can be a lot more productive at writing code
by making extensive use of the templates in ATS library.

While we all love concise and elegant syntax, the syntax of ATS (as of now) 
is quite verbose. One big reason for this
is that ATS aims to provide extensive debugging support at compile-time. 
Say you have just finished writing a Python
program. Then it is only logical that you test it by running it. After 
finishing writing an ATS program, you could run it or
you could find ways strength the types used in it so as to flush out 
potential bugs.

Now let me say a few words about the following syntax:

`for i,j: C.i.j = A.i.k * B.k.j`

Clearly, this syntax indicates that the sizes (nrow and ncol) of a matrix 
needs to be attached to the matrix. This would
cause serious problems if you want to process submatrices (e.g., when 
implementing Strassen's matrix multiplication).
In order to process arrays efficiently, the sizes of arrays really need to 
be detached from the arrays themselves.

Another issue with "elegant" syntax is that it does not go well with 
debugging. Often, "elegant" code is only obtained at
the end of a "messy" debugging process.

Hope this can clarify a few things on ATS for you.

--Hongwei

On Sunday, January 23, 2022 at 12:46:12 PM UTC-5 Yann Le Du wrote:

> Dear ATSites,
>
> First, impressed by the power of ATS which unfortunately for me is still 
> inaccessible even after spending the typical time I spend overviewing other 
> languages. For sure, I've listened to many people saying how hard it was, 
> so that didn't help ;-) Maybe they want to keep ATS for themselves and 
> frighten away potential new users ?
>
> I'm a physicist, cosmologist, currently working on setting up a project 
> involving image reconstruction, around what the Chebfun matlab toolbox 
> implements. Now, I've been looking at Dex, he new google research language, 
> because that's typically what I need,for exactly the same reason the 
> designers made Dex (escape Matlab and go for more than its clone on juice, 
> Julia) but it looks very experimental and doesn't really have all I need, 
> especially interfacing with C.
>
> So first, would I be able to massage ATS into allowing some nice syntax, I 
> mean can I code a library (using whatever tools I totally don't understand 
> today) that would allow me to write 
>
> `for i,j: C.i.j = A.i.k * B.k.j`
>
> In a very similar way to Dex (who has ranged integer type for the 
> indices), i.e. which would be interpreted as :
>
> ```
> for i in rows range of A:
>   for j in colums range of B:
>     for k in cols of A == rows of B:
>       C[i,j] = A[i,k] * B[k,j]
> ```
>
> or whatever equivalent in ATS.
>
> You will notice that it loops implicitly on k (Einstein summation), thus 
> without me specifying k, and all the indices getting checked like in Dex at 
> compile time, with inference wherever needed. This means I want to be able 
> to write M.2.3 = 25 (meaning M[2,3]=5) without casting overhead like in Dex 
> (they have to cast from integers to ranged ordinals if I remember).
>
> I would also need support for 128 bit integers and all for cryptographic 
> uses, the possibility of defining
>
> foo(m `Matrix[12 rows, any u32 in [0,23] columns, any float type for the 
> elements, unknown variance]`)
>
> and then call foo with `foo(b)` and b is checked to fit the type declared 
> for foo's arguments, so it wold tell me if I try to put in a matrix with 
> too many rows, but accept a matrix with 12 rows and 21 columns filled with 
> f32, the possibility of defining a set of accepted types, including 
> constants, and check if what I use belongs to that set, abstractions like 
> OO to better contain the math abstractions we manipulate.
>
> Also, the possibility to implement the right structures for SIMD and all 
> that, SOA, etc. This organizing my memory as I want, perhaps not from the 
> start, but as the project progresses.
>
> The possibility of multicores, and distributed computing.
>
> Proving that some functions are right.
>
> And last but not least, how much will I have to [un|re]learn when ATS3 is 
> released ?
>
> And maybe other questions will follow if the above receives positive 
> answers...
>
> By the way, why no Discord channel ? It's so helpful for a community.
>
> It's a big pile of questions, I just want to know if learning ATS could 
> make those features possible. My other path is to go to Rust and hope I can 
> massage the macros to handle my syntax, but Rust doesn't have true range 
> types for the tensor indices I want to use, although some crate imitates 
> them, and ATS looks much more powerful to me.
>
> That's it, I hope ATS can do all that.
>
> Best,
>
> Yann
>

-- 
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/6e525d0c-f7c3-4db3-a1c9-e680d05440aan%40googlegroups.com.

Reply via email to