What is cppia scripting?
Asked Answered
L

2

8

I was just looking at the Change Log for Haxe 3.2.0-rc.2 and found this at the end of New features list:

cpp : inititial implementation of cppia scripting

Can anyone can tell me what this means? I can tell that it has something to do with C++, but googling this gives nothing related to programming/scripting unless you count Haxe related results.

Lunt answered 2/5, 2015 at 23:21 Comment(0)
C
8

Cppia (pronounced "sepia") is a new part of the C++ target for Haxe. In the most basic sense it is a "scripting" language for hxcpp which can be compiled and run without the use of a C++ compiler. Some official documentation can be found here:

Getting started with Haxe/Cppia

In order to compile to cppia you need to modify your hxml build file. Add a -D cppia flag to your build and change the output to have a .cppia extension. Here is an example.

-cpp out.cppia # the cppia output file
-main Main     # your Main.hx file
-D cppia       # this enables cppia compilation

After you do that you compile the hxml file like normal with Haxe. It will give you a file named out.cppia which can then be run through hxcpp using the command haxelib run hxcpp out.cppia. One drawback to this method is there is no way to use native extensions without building your own cppia host. So if you need to run something using OpenFL or Kha you'll have to wait until they support cppia.

According to the information I've found it sounds like cppia runs as fast as Neko JIT. Considering the compile times are just as fast I can see this becoming a good alternative to the neko target in the future.

Additional information can be found in slides from a talk given by the creator, Hugh Sanderson, at WWX 2015.

http://gamehaxe.com/wwx/wwx2015.swf

Cost answered 23/6, 2015 at 20:21 Comment(0)
P
7

A brief search only pointed out some IRC logs. Some of them are of use.

It seems like it's a specific output format for Haxe code that is designed for use in development for rapid code modifications. Say, when developing a game, the need to recompile and redeploy your application every time you make a slightest change really slows down your progress. People have reported this to be a problem with iOS development.

Cppia seems to address this with a specific code format and a JIT compiler based on SLJIT (found that in hxcpp repo). Presumably (I concluded that from the logs referenced above), it allows you to modify parts of your application at runtime.

That said, cppia as a language is probably not for direct use and is intended to be generated by the compiler.

These are the strongest clues I can come up with and I'm surely missing some details. But since the feature is pretty new, these details may even not be known right now.

Precritical answered 2/5, 2015 at 23:58 Comment(4)
thanks D-side, I found the SLJIT folder before and knew straight away that something other then generating C++ was going on using this output target, but couldn't find out what. I wont accept this answer for know, will wait awhile before doing thatLunt
@Futago-zaRyuu you could ask someone else for a confirmation, I'm curious to find that out too. A simple yes/no question is easier to answer for the busy devs than "explain what this is"-type.Precritical
@Futago-zaRyuu any progress on confirming this?Precritical
So far, it seems your right :), check Matt's answer belowLunt

© 2022 - 2024 — McMap. All rights reserved.