val A = 1
val B = 2
val () = println! “(” A " + " B “) = " (A+B) // ATS style
val () = println! (”(", A, " + ", B, ") = ", A+B) // also ATS style
val () = cout << “(” << A << " + " << B << ") = " << (A+B) << endl // C++
style
On Tuesday, February 25, 2014 9:05:43 PM UTC+6, gmhwxi wrote:
You guessed right
I did this experimental style of outputting when I was translating some
C++ code.
The macros ‘print!’ and ‘println!’ in ATS are loosely based on python’s
print, which are
pretty convenient. So I no longer plan to support C-style printf in ATS2.
If one need
printf, then one can always use $extfcall to call it directly. While this
is not type-safe,
it is really a very minor issue.
Is it possible to set formatting options with print! and println! ?
For instance, with printf one might do:
printf(“%04X”, 15) // prints 15 in hex, zero-padded to 4 digits
How can this be implemented with println! or print! ?
On Tuesday, February 25, 2014 6:16:22 AM UTC-5, Artyom Shalkhakov wrote:
I’m wondering on what grounds would one prefer one style to another?
For instance, I’d probably pick C++ style formatting if I were rewriting
some C++ code to ATS. Other reasons?
On Monday, February 24, 2014 11:56:11 AM UTC+6, gmhwxi wrote:
Today I figured out a way to do C++ style of outputing in ATS.
val A = 1
val B = 2
val () = println! “(” A " + " B “) = " (A+B) // ATS style
val () = println! (”(", A, " + ", B, ") = ", A+B) // also ATS style
val () = cout << “(” << A << " + " << B << ") = " << (A+B) << endl //
C++ style
I did this experimental style of outputting when I was translating some C++
code.
The macros ‘print!’ and ‘println!’ in ATS are loosely based on python’s
print, which are
pretty convenient. So I no longer plan to support C-style printf in ATS2.
If one need
printf, then one can always use $extfcall to call it directly. While this
is not type-safe,
it is really a very minor issue.On Tuesday, February 25, 2014 6:16:22 AM UTC-5, Artyom Shalkhakov wrote:
I’m wondering on what grounds would one prefer one style to another?
For instance, I’d probably pick C++ style formatting if I were rewriting
some C++ code to ATS. Other reasons?
On Monday, February 24, 2014 11:56:11 AM UTC+6, gmhwxi wrote:
Today I figured out a way to do C++ style of outputing in ATS.
val A = 1
val B = 2
val () = println! “(” A " + " B “) = " (A+B) // ATS style
val () = println! (”(", A, " + ", B, ") = ", A+B) // also ATS style
val () = cout << “(” << A << " + " << B << ") = " << (A+B) << endl // C++
style
I did this experimental style of outputting when I was translating some
C++ code.
The macros ‘print!’ and ‘println!’ in ATS are loosely based on python’s
print, which are
pretty convenient. So I no longer plan to support C-style printf in ATS2.
If one need
printf, then one can always use $extfcall to call it directly. While this
is not type-safe,
it is really a very minor issue.
Is it possible to set formatting options with print! and println! ?
For instance, with printf one might do:
printf(“%04X”, 15) // prints 15 in hex, zero-padded to 4 digits
How can this be implemented with println! or print! ?
I’m wondering on what grounds would one prefer one style to another?
For instance, I’d probably pick C++ style formatting if I were rewriting
some C++ code to ATS. Other reasons?On Monday, February 24, 2014 11:56:11 AM UTC+6, gmhwxi wrote:
Today I figured out a way to do C++ style of outputing in ATS.
val A = 1
val B = 2
val () = println! “(” A " + " B “) = " (A+B) // ATS style
val () = println! (”(", A, " + ", B, ") = ", A+B) // also ATS style
val () = cout << “(” << A << " + " << B << ") = " << (A+B) << endl // C++
style