5 ms·
From a cursory search, it looks like ATS is implemented as a "compile to C code" language. This kind of implementation is actually quite concerning, because it
by jcranmer 6y ago
From a cursory search, it looks like ATS is implemented as a "compile to C code" language. This kind of implementation is actually quite concerning, because it means you're punting through a language which is notorious for its heavy reliance on undefined behavior, and there is no way to opt out of undefined behavior in some cases.
Also, from what I can tell of its mailing list, ATS is a pretty dead project: https://sourceforge.net/p/ats-lang/mailman/ats-lang-users/ https://sourceforge.net/p/ats-lang/mailman/ats-lang-users/ shows only announcements post-2015.
- vmchale 6y agoIt's a google group! Not dead at all, though it is... ATS :)
- kergonath 6y agoIt’s not more concerning than a language that is compiled to assembler. It all depends on the quality of the compiler/transcoder.
- ghostwriter 6y ago> This kind of implementation is actually quite concerning, because it means you're punting through a language which is notorious for its heavy reliance on undefined behavior, and there is no way to opt out of undefined behavior in some cases. if it were a new project I'd agree, but if there's an existing C codebase, it already contains all these UBs and the goal of the rewrite is to grow a formally-verified critical core functionality in ATS that would still inline the rest of the project intact. This way the formally verified part of the project can grow naturally through small iterative steps without major disruptive changes to the tooling and supportive infrastructure. People who are familiar with C can acquire basic ATS patterns pretty quickly (within a month or so), and the same is applicable to those who are familiar with ML-family languages.
- DSMan195276 6y ago> This kind of implementation is actually quite concerning, because it means you're punting through a language which is notorious for its heavy reliance on undefined behavior, and there is no way to opt out of undefined behavior in some cases. I think it's worth pointing out that you can't always get away from those undefined behavior situations even if you skip C all together. Rust, for instance, has some internal/implementation details I've run across that are just C undefined behavior details leaking out of the LLVM IR instructions they use to implement the language, since those instructions have the same undefined behavior semantics as the corresponding C code they're used for.
- nicoburns 6y agoNot always, but a lot of the time. There are also a whole bootload of things that are UB in C but have defined semantics in Rust.
- DSMan195276 6y agoSure, I was mostly responding to the "compiles to C vs. directly to GCC/LLVM". I don't think the difference is actually all that relevant in terms of avoiding undefined behavior, a lot of the undefined behavior situations still need to either be worked around (or accepted) when generating the IR - it's not as simple as "skip C, UB is gone".
- ghostwriter 6y agoIt's far from dead, a new version of the compiler is being developed on top of ATS2 (https://github.com/githwxi/ATS-Xanadu https://github.com/githwxi/ATS-Xanadu). ATS2 is being updated too (https://github.com/githwxi/ATS-Postiats https://github.com/githwxi/ATS-Postiats), the latest stable release happened last December: https://github.com/githwxi/ATS-Postiats/blob/master/CHANGES-ats2 https://github.com/githwxi/ATS-Postiats/blob/master/CHANGES-... https://sourceforge.net/projects/ats2-lang/files/ats2-lang/ https://sourceforge.net/projects/ats2-lang/files/ats2-lang/
- z3phyr 6y agoDoes Rust ultimately not compile to machine code? Is the underlying hardware proven? You are ultimately going to get your code punted through untyped data lines and unproven logic units.
- estebank 6y agoRust has the good sense to keep all its Undefined Behavior behind unsafe blocks.
- lmkg 6y agoA language that compiles to C does not inherit all of C's problems, and doesn't "punt" on it for undefined behavior. I mean, after all, Rust compiles to Assembly, which is even unsafer than C, but Rust is still considered safe. A compiler has greater ability to enforce invariants that make the resulting code safe. The issues with C result from faulty humans; running through a program gives an opportunity for those issues never to occur to begin with.
- umanwizard 6y agoHow is assembly less safe than C? C is full of undefined behavior which might be interpreted differently by different compilers, whereas (maybe with the exception of some unusual circumstances) the behavior of assembly language for major instruction sets is 100% documented.
- ncmncm 6y agoI see that you have not coded in assembly language.
- umanwizard 6y agoI haven’t; I’ve only read it a bit. I could be wrong about a relative lack of UB compared to C - do you have examples?
- ncmncm 6y agoWhen you code in assembly language, you discover how incompletely documented every chip is. Any detail of behavior not documented might change in a later chip, and is thus UB. Makers of compatible chips are obliged to keep a collection of systems with all the extant chip designs to run experiments against, and to maintain their own documentation of discovered but unspecified commonalities that users' code may have come to depend on. Each released chip, and each stepping of each release, has its own unique set of bugs-- deviations from documentation, from observed behavior of previous chips, and of chips yet to be released. Writers of assembly code need a compendium of behaviors, documented or not, that cannot be relied on for the set of release platforms. Many such bugs depend on an ill-characterized history of processor states, making them, often, (more or less) reliably reproducible only with a particular program that was discovered to evoke each. Often the behavior noted is seen only once in a million runs. An example on Intel is the popcount instruction that runs very slowly, sometimes, in chips released up to a few years ago. The instruction appeared along with ...SSE3?, and had the bug until it was noticed and fixed in a subsequent chip. The bug is the reason Gcc uses the same register for source and destination when it emits this instruction. Intel's ISA manual does not mention this behavior.