Forums

cobra as part of haxe toolkit

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

cobra as part of haxe toolkit

Postby kobi7 » Sat Oct 31, 2015 6:52 am

Cobra has the sweetest syntax I've seen, feature-wise is very clean, and has excellent error messages, has testing built in, contracts, good things.
I only see people complain about the dot net part.
Cobra uses most of dot net for its operation but it's not strictly glued to it, correct me if I'm mistaken.

there is a language and toolkit called "haxe". it's a modern language and compiler, the unique thing is that they have multi targets. you can compile to c#, java, c++, android, ios, flash, html5, js, ...
it's mostly for game makers, targeting mobile.
the compiler is written in ocaml, and it's possible to create new frontends or new backends.
the idea is to create a parser, and all the things the frontend part needs, so cobra (syntax-wise) can be part of this eco system.
it is an effort and work but the benefits could be huge. an indie dev will find it practical to use haxe, and cobra syntax would make it fun and pleasurable.
best regards to everyone.
Falun Dafa is Good.
Truth, Compassion, Forbearance is Good.
kobi7
 
Posts: 82
Location: Israel

Re: cobra as part of haxe toolkit

Postby Charles » Sat Oct 31, 2015 12:40 pm

How do they handle memory management? (garbage collection, ref counting, etc.)

Do they have value types?

Do they have generics like List<String> and if so how are those handled as compared to other languages like C++, Java and C#, each of which have their own approach?

I'm in the middle of some other things so don't have time to learn Haxe right now. If you could share your knowledge or research these questions that would be helpful.
Charles
 
Posts: 2497
Location: Los Angeles, CA

Re: cobra as part of haxe toolkit

Postby kobi7 » Sat Nov 21, 2015 2:36 am

Hi Charles, sorry for the late reply
I'll answer your questions to the best of my knowledge. I'm quite a beginner here.
I had a different thought, that instead of creating a frontend, it may be easier to create a backend to cobra.
anyway, here are some answers:
How do they handle memory management? (garbage collection, ref counting, etc.)

GC.

Do they have value types?

there are a few primitive types
there are abstract types, which are evaluated in compile time. kind of similar to unit of measurement.
for example, the inner value may be int, but you want type checking to differentiate it from another int, so the abstract definition allows that, but it all vanishes in the code generation. (just for error checking)
There is another thing, similar to structs. called typedef. (like in c i guess)
basically a data struct, with no functions attached. but can inherit from other typedefs, and add other fields.
very useful and clean. you can realize from glance, that this is just passing data.

Do they have generics like List<String> and if so how are those handled as compared to other languages like C++, Java and C#, each of which have their own approach?

they have generics and some data structures. I'm not sure what you mean by "handled".
I think it's very similar to C#. there is nullability option, with a generic syntax, that can make the primitive types nullable, likely created to satisfy the various targets. I think it doesn't have non-null by default. but i am not sure.

Charles, I will repeat what I said at the beginning. it could be easier to just generate haxe code, since it's very similar to c#.
then the user takes the haxe code, tweaks some things and compiles on multiple targets.
I'm not sure if this suggestion is even relevant to this project,
since I feel cobra is pretty much complete.
best regards and hope this helps,
kobi
Falun Dafa is Good.
Truth, Compassion, Forbearance is Good.
kobi7
 
Posts: 82
Location: Israel


Return to Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron