I think I misunderstood your earlier message.

If I understand you correctly this time, then what you mentioned in this
message
can already be done in ATS2 (you need ats2cpp for using g++ on the generated
code):

https://github.com/githwxi/ATS-Postiats/tree/master/contrib/ats2cpp
https://github.com/githwxi/ATS-Postiats/tree/master/contrib/ats2cpp/STL

The code in STL shows a way to wrap linear and dependent types around
various
STL functions (stack, deque, etc.).

By the way, this is also what is planned for xats2cc, which aims at
compiling XATSCML to C/C++.


On Thu, Jan 21, 2021 at 5:36 PM Dambaev Alexander <ice.redm...@gmail.com>
wrote:

> And that is why I dream about an ability to be able to render classes to
> Java/C++: as soon as we might have a XATSCML->Java / XATSCML->C++ translator
> Ie, to be able to render something like this:
>
>
> ```
>
> UCLASS()class AMyActor : public AActor{
>     GENERATED_BODY()public:
>
>     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage")
>     int32 TotalDamage;
>
>     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage")
>     float DamageTimeInSeconds;
>
>     UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Transient, 
> Category="Damage")
>     float DamagePerSecond;
>
>     ...};
> ```
> https://docs.unrealengine.com/en-US/ProgrammingAndScripting/ProgrammingWithCPP/IntroductionToCPP/index.html
>
> Such that we should able to inject things like `UCLASS` into output or 
> `UPROPERTY`.
>
> At the same time, this means, that we can have a part of program, that is 
> written on a C++ and part, which had been rendered to C++ by ATS, such that 
> to use rendered parts borderlessly, we need to be able to describe 
> host-languages types in ATS, like:
> ```
>
> typedef std_vector(a:t0ype, n:int) = $extype_struct"std::vector<a>"
>
> ```
>
> and then we should be able to use, say `push_back` either by using $extfcall 
> or being able to describe it in statics:
>
> ```
>
> extern fn {a:t0ype} push_back{n:nat} ( v: !std_vector(a, n) >> std_vector(a, 
> n+1), value: a): void
>
> ```
>
> but this means, that ATS should be able to render
> ```
>
>   val vec = (* some constructor *)
>
>   val () = push_back<int>( vec, 1)
>
> ```
>
> into
> ```
>
>    std::vector<int> v;
>
>    v. push_back( 1)
>
> ```
>
> Otherwise, ATS should render structures into host language and either make it 
> easy to use from target or we will have to marshall the data between target 
> language and ATS, but why do we need a translator into a target language
> if we still have to spent development time and CPU cycles to marshal data 
> from/to ATS? :)
>
>
> So what I mean is that there are a lot of 'mainstream' OOP languages, which 
> are being used for production, say Java and C++ and currently, in order to 
> write, say, non-C++ for Unreal Engine development, or non C# for Unity3D or
> non-Java for Android development, you sign for a pain of marshalling data and 
> writing a lot of bindings (for both sides: target language and higher level 
> language), ie, loosing the time in fighting against the platform in pursuit 
> of using
>  something more, that platform is not able to provide.
>
> So for me, it is clear, that ATS2 does the great job to eliminate the 
> fighting against C to a some extent: ie, ATS requires no marshalling and we 
> have $extfcall(), so in the case of 'I need to finish this today', we can use 
> a bunch of $extfcall()s for C libraries and it will
> not be a fighting against the C target.
> But, no matter how sad it is, I see a trend, where C API becomes obsolete. 
> Even GCC is now using C++ as a language of implementation. Many sources say 
> 'use Golang instead of C for most of your tasks' and C slowly becomes 
> 'language for kernel API
> or embedded' development, which means, that very few projects now provide C 
> libraries, which I can use a an ATS developer. For example: I know, that only 
> Godot engine provides C library, but neither Unity nor Unreal Engine. (or 
> maybe I'm wrong?)
> But if we imagine that someone had developed a translator to C++/Java/C#/Go - 
> will ATS-developer still be fighting against the platform? I think he will 
> fight against OOP platforms at least, as it will still require to manually 
> create classes at least, from which
>
> he will be able to call functions, rendered by ATS. And things like 
> std::vector, std::string and etc may require marshalling to/from ATS, even if 
> ATS itself renders into a target language...
>
>
>
> --
> 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/CAHjn2KzpLfvckjhsWqyOxEVTPy1avB_B0znx8YDz_4Obz_xD%3Dw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ats-lang-users/CAHjn2KzpLfvckjhsWqyOxEVTPy1avB_B0znx8YDz_4Obz_xD%3Dw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAPPSPLoqGmFPm0J6WeySayf_TLuFYEHB-aQpaZkV4PKzVJBCPA%40mail.gmail.com.

Reply via email to