Angeljuice released!

i finally launched it…



Just few questions,

How did you made the syntax highlighting stuff ? (Have you written it from scratch ?)
[Don’t take this comment as a critic]
What’s the use of such “.Net” clone ? I don’t understand the idea…
[/Don’t take this comment as a critic]

Anyway, good work with overall IDE, it’s almost like Scite but with our beloved Juce…

the syntax highlighting was such a hard work. it tooks some weeks before i got it working as it is. i started from the juce TextEditor, hacking it to syntax highlight with regular expressions. but since the text editor class in juce is quite memory intensive when adding/removing characters, and a regex syntax lexer is somewhat far from be fast, i started keeping off the TextEditor all the unwanted stuff, like multiple fonts, and added to it some classes that do an internal keep of the text document itself, with fast access. also i’ve integrated a virtual lexer class, interchangeable at runtime which takes care of tokenizing the document only for the needed parts: pasting a big document took some times to parse, but writing character after character is still possible without slowdowns even with big documents. there is still room for improve, but actually is good as it is.

“.net” clone ? sorry i don’t understand… and i don’t see .net related to this.

Ok, that seemed a really hard work…

About .Net, I’ve only overlooked the scripting example, but it looks like a .NET example to me (#pragma corelib <=> using System.etc;, no pointers but Java/C++ like syntax)

If I understand correctly, the idea is too fasten developing with a interpreted prototype, right ?
It looks like C# gadget from M$ to me in this goal, the only difference is that it is cross platform thanks to Angelscript and Juce, but with Mono on the other side, I don’t really understand what are the “killer/keypoint features” in AngelJuice that I couldn’t do with .Net as fast for prototyping application.

I still have to learn the “new” differences/subtilities from C++ to the new language, so why choose AngelJuice in this case ?

I’m sure you already have thought about this, it’s just I don’t get the idea, and I’m probably not alone.

Again, it’s not an attack, but a constructive critic, if I can save 30% of my time by identifying error in a design with a quick and dirty but working prototype then it’s worth it.

yes it was a funny hard work :wink:
actually there aren’t keypoint features in AngelJuice that you couldn’t do with dotnet as fast for prototyping application. in dotnet you could do even more actually, so don’t choose angeljuice as an ide. you could also take python and write fast applications in that, or even download Eclipse, a couple of java runtime and do more things even.
This was something i made for people that likes juce. Angelscript is one of the scripting engine that impressed me more out there. I took it cause is 90% like c/c++, is simple for a c coder to understand, is extremely fast to code, is extremely fast to run, is extremely fast to bind… (ah the pointers are round the corner since i’m helping andreas to improve it).
Afterall i don’t know if angeljuice is worth it, i just made it and will continue improving it. Take this as an experiment for developing juce alike applications in perfect juce style, testing algoritms, entering more into the juce world. If you know juce then you should understand why you’re posting in this forum. If you want only save time or money then look somewhere else, the world have zillions tools better than this.
If you’re developing a vst with juce i will sure tell you… but it’s worth it ? there are zillions better out there… why choose yours ? me, as juce lover i would have appreciated your intent of making a juce vst, afterall…
anyway, i’m not criticizing your critic. you’re 100% right, this is only a gift for Julian and Andreas for giving me their powerful tools… i shouldn’t have released to the public… :stuck_out_tongue_winking_eye: ehe



So what you are saying is that one of the keypoint feature is the ability to write a fast VST (unlike .NET, or anything else) ?

It sounds good enough to me. Juce allows me to save time and money probably more than .Net (in the long term too because it is native), that’s the reason why I’m here.

I’m just not interested in VST stuff, and afterall Juce is also good for its graphic part, it cross platform toolkits, etc…

I think I got the point, Angeljuice is a platform for fast VST making and testing.

no you don’t get the point. angeljuice actually (but in the future it could be) isn’t a platform for vst making. is just an experiment making the good things that juce have brought to us ("…good for its graphic part, it cross platform toolkits, etc…") scriptable through a easy engine with practically low learning curve and 0 complicate things to setup before have an application running (take the graphics_draw.ajs example in angeljuice site and drag and drop over angeljuice, practically looks like coding juce in a c++ enviromnent, isn’t it ?). take angeljuice as it is, as a workbench for testing algoritms.
atm is not more than that. so if you plan do more intricated things then stick with .net, c++ or java (python/tcl anyone out there? ahaha)… i just don’t understand why you don’t see any reason for this to exist.

[quote=“X-Ryl669”]So what you are saying is that one of the keypoint feature is the ability to write a fast VST (unlike .NET, or anything else) ?

It sounds good enough to me. Juce allows me to save time and money probably more than .Net (in the long term too because it is native), that’s the reason why I’m here.

I’m just not interested in VST stuff, and afterall Juce is also good for its graphic part, it cross platform toolkits, etc…

I think I got the point, Angeljuice is a platform for fast VST making and testing.[/quote]

i have a hard time seeing why you have such a hard time finding a reason for this to exist!

sure you could use .net to quickly prototype stuff etc…, but most of us here use juce because we like juce. i don’t want anything to do with .net. if i were to dabble with some kind of angelscripty thing, i would be happiest if it was juce-bound, rather than something entirely different.

basically, every question you have asked here, i have to ask “why are you even asking that question?”

me too. anyway that’s why i choosed angelscript:

  1. syntax is 90% like c/c++ so it’s easy for a c/c++ coder (me mainly) to understand
  2. is strongly typed (which scripting engine support this?)
  3. is very fast (benchmark showed that is faster than lua, python, gamemonkey, squirrel, and lot of other scripting engines)
  4. embedding c/c++ class and functions is a matter of calling “1” function in the registration process of the engine
  5. source code is well written and tweaking or understand what it does is not extremely complicated (take python sources… megabytes of bloated stuff that u don’t even know where to start reading for understading the core behind it).
  6. it not force you to code OO pattern
  7. it is written by a friend, human, skilled coder (think of Andreas like Jules behind the juce project): not many “business” “busy” “bastard” (bbb) people that don’t even respond to emails (aka some ***** experts).
  8. i can help angelscript as i’m helping juce to grow as a better tool. finding bugs, suggesting features and so on…

i hope this is will explain why i had made this choice, the same reason because i’ve choose juce all over other framworks…

Python is strongly typed (only language that I know of that is both strongly and dynamically typed, contrary to C++ which is weakly statically typed, which is why I think they go well together, they fill each others voids).
And just how is AngelScript faster then Python or lua?
And understanding the core of Python is quite simple, I dumped the entire source into one of my apps and integrated it quite nicely.
And you make a scripting language interface to C++, not like C++, so the people using it don’t have to know something as complicated as C++, in my opinion.

Although I like AngelScript, quite a bit actually, the reasons you give are not quite accurate as to why it should be chosen.

yeah probably you’re right. but from my point of view, i don’t find c++ syntax so much complicated. indeed have a generous guy taking over a project, and speak with him everyday thinking about making it better and better is such a thing that i can’t find everywhere else. so i correct the points:

  1. just i want to give my 0.02$ to a project that it it deserves better praises than what it have actually.


That’s true. :slight_smile:

Personally I love the C++ syntax, there are only a couple things I would change about it to make it the perfect language. The reason I chose Python is a couple of things. Whenever I make a scripting language, I am not going to use it, I will use C++ as I am more comfortable in it and therefor can program faster in it. I used to use LUA as a scripting side for others, which the people who did use the scripting side saw it as too complicated (they didn’t like all that array/table stuff, and braces) and they hated C/C++ due to all the braces and such (still don’t see the issues, I love braces, they absolutely define things making it easier, but oh well…). I gave Python a try as a scripting language, they loved it, found it easy to use, I found it easier to bind things in then LUA (I could directly represent my classes as classes in python, could derive from my classes in python, I could derive from python classes in C++, it was just amazing the control I had). I have not made another thing in LUA since. I also find Python to be amazingly fast, and the reason I countered whatever benchmark you are quoting is that they no doubt didn’t optimize it for their application. I can make php outperform raw C if I don’t do things correctly. The only thing I see Python slow in is raw math calculations with number greater then ~100, but wrapping those in Psycho or just doing it in C++ (I could make a function in my program, or as a python extension module, and people could make it a function of the class they are making even, as stated, the control I have from the C++ side is astounding) fixed that. Another big thing I’ve found out recently about using Python as a scripting language and exposing the major parts of my app to it is that I can make an idiotically easy to use factory. Literally, I can dynamically call up classes from my C++ root program without needing to use my rather large (but very nicely powerful, took me a year to get to the current status, not that I use it anymore since I found out about this) registry/factory library. I can plug in classes from Python, I can make a python extension library in C/C++ and register that through python for my class registration. Just for giggles, I could do something like this when setup (in Juce pseudo-stuff):

Class shapeButtonClass = ClassFactory::getClass(T("Juce.ShapeButton"));
Properties shapeButtonProps = shapeButtonClass.getProperties();
// You could do something with the properties, like make a listbox of all things that can be changed, like name, the colours, position, etc... and change them by calling them back onto an instanciated class
Juce::Button *shapeButton ="ShapeButtonName"), Colours::blue, Colours::red, Colours::green);
shapeButton.setBounds(5, 5, 75, 25);

Mostly pseudo-code as stated, I actually wrap classes up with smart pointers of my own design (wraps Python’s memory handling to have everything go through it) that exposes the class for whatever you want it to be (like button, the cast will fail if the class you instance does not derive from the class you pass as the template param though, even if going through C++ to Python <even back to C++ then to Python then to C++ and so on> boundries). If you instance a class that you know nothing about, you can get a list of its properties which will tell you what they are using python’s type system. If you just want to try setting a value directly, well, here are some examples:

Object someInstance; // some instance defined earlier, Object is the generic Python type that can reference any class, but is not a class itself (unlike Java).
someInstance['someIntegerOnTheClass'] = 42;
someInstance['someMethodOnTheClass']("I can pass in anything, like strings, int's, class pointers, etc...", 38, somePointer);

From the Python side, also quite easy, duplicating this example:

from Juce import *

class MyComponent(Component):
    def __init__(self):
        self.myDragger = ComponentDragger() # just being lazy and making everything public
    def resized(self):
    def paint(g):
        rand = Random()
        bounds = self.getBounds()
        color = Colour(rand.nextFloat(), rand.nextFloat(), rand.nextFloat())
        g.setFont(rand.nextFloat() * 80.0, 0)
        g.drawSingleLineText("PyJuce !",
    def timerCallback(self):
    def mouseDown(e):
    def mouseDrag(e):
        self.myDragger.dragComponent(self, e)
    def mouseDoubleClick(e):

if __name__ == "main":
    # In other words, this is the *first* run script,
    #  don't have to do this, but I like doing it...
    comp = MyComponent()
    comp.centreWithSize(400, 300)

What is with the comp.self.whatever() stuff in the example? Will not comp.whatever() work?

And, er… just noticed how long this got. I barely scratched the surface of what I have been doing just for note. :slight_smile:
Gotta go, work is over…

To OvermindDL1,
You should have a look for Christopher Diggins’ “any” typesafe variant that allows dynamic typing with runtime type safety checking. It is a good mix up between Andrei Alexandrescu’s templated Variant and boost::any that doesn’t exactly does what it says it does.
I think Python is good for what it is, ie a interpreter of a easy to write language. But everytime I have to choose to a software solution written in Python or Java, I simply try to find an equivalent solution in C or C++.

It’s my personal experience, but most big python projects are resource hungry, leaks memory awfully because of garbage collection and cyclic reference, and finally are slow too.
Debugging memory leaks in Python code is a nightmare (I’ve patched Python maybe 20 times, following bug reports about memory leaks), and not speaking about Java.

I’ve tried many, many “solutions”, but in the end, I’ve simply switched to C/C++ for production safe software. (We still have a Java multi-something server at my work which runs on a 2xXeon (2GB RAM) and still requires rebooting every now and then due to all resources not being released, euh, sorry garbage collected)

I’m using Gentoo with portage, and it is the perfect counter-example of a good written python software.

To conclude, I personnally avoid all automatically garbage-collected languages like plague, because, by design, it is going to be resource hungry, and leak memory, and it is full of hacks (you have to think of garbage collector bug when designing a class to avoid cyclic references, so in the end, you do the same job as writing good memory code with allocation and destruction).
On the other side, with SchedSkin improving every day, it might be possible that Python gets more spotlight soon.

To haydxn,
The reason is that if I want to prototype an application or test an algorithm, I simply fires up VS6.0, create a new project, add Juce’s lib to linker, and start coding in C++. I just don’t see where I’m saving time with AngelJuice here.

So I guessed it was elsewhere, probably in the scripting stuff, so I took a closer look to the scripting language, and finally except for pointer less (they are just references), and garbage collection, I don’t see the real advantages (yes it is using Juce, but so is VS6.0 when adding #include “juce.h”)

Okay, Angeljuice is the perfect technical demonstration of Kraken’s high coding skills. I do respect him for this piece of sugar. I’m just asking myself when and where can I use AngelJuice in-place-of my current IDE.
And I haven’t found a good enough reason yet. (I know I’m dishonest)

no, actually there is no inheritance implemented, only interfaces. actually comp is of the class you’re declaring in the script, and it has no methods registered except the ones that u defined. The real juce published object is the “Component self;” property of that class, which holds juce methods. so that’s why i’m calling it. When inheritance and pointers are ready to go coding could be more fast (for me only i think).
also andreas has currently finished to integrate the possibility of not using this keywords in the class methods, so as you see, this is a clear young project.

i’m 101% with you.

I’m just asking myself when and where can I use AngelJuice in-place-of my current IDE. And I haven’t found a good enough reason yet. (I know I’m dishonest)[/quote]
you don’t have to use it if you don’t have a reason. it is not meant to replace your IDE, probably now is just only a show of my skillz as you say, nothing more. only say, for help a friend of mine i had to connect to a url servlet from my pc yesterday, take out some information from that (parsing out chunks of integers and floats and strings), update some configuration based on the connection data results, while also parsing logs and moving some other files here and there, checking their version and modify date. with angeljuice i’ve written, debugged and runned it in SECONDS, with a single script. setup times are practically near to zero, if you just know a little of juce syntax. the good news is that i’ve written a bunch of functions, that i can practically take like this and use even in a big f******g c++ project if i wish to. but for that purpose, is it worth it that i build up a c++ project ? or launch eclipse ? or install python then search for libraries and documentation and testing here and there… mmmh 8)

sometimes if i make tools is because i want to feel confortable with them. but, if i have to write a complete application, i just stick with a c++ full bloated ide, that can’t be replaced with NOTHING else.

if you just don’t know why you should use this, then just stick with your VS6.0 and fire up juce.h where you need to.

kraken: Ah, interesting way AngelScript does it (never really looked deep into it, as stated, it is C++'ish, so I figured to just stick with C++ :slight_smile: ), wrap, instead of inherit… Seems odd, how do you handle casting (like a Button pointer pointing to a TextButton)?

I could whip up a program in about two minutes that would do nothing but launch python with a specified script. Just distribute the exe and the dll, nothing else special. Would probably want to include a few good libraries though, like String and such, easilly embeddable, or make a Juce wrapper embedded (not quite two minutes creation time). At that point, anyone would just make a script and launch it with the exe. With a little more work I could embed python statically in the app too, but no real point…

X-Ryl669: I already have used boost::any, but only in testing. In my opinion, if you have to essentially do a void* cast (which is about what those do…), then there is a better way you can write it. Even in Python, you are not supposed to use a single variable for multiple objects, you are supposed to treat it as static typed, even though it is weakly typed. And yea, I know of the things you speak of, but they have been greatly fixed in the latest versions (>2.4, I use the CVS version for my projects).

And, as stated, I never code anything in Python (I know just enough of the language itself to work my way around), I make it as an interface for non-coders to use, and for that regard, it has been perfect.

Quick bit of trivia, did you know that Bjorn (spelling?) said he would of put ‘self’ instead of ‘this’ in C++ except he didn’t think of it in time. :slight_smile:

And yea, one of the few things Microsoft seems to do perfect (compared to anyone else) are their dev IDE’s.

OvermindDL1: actually angelscript is under heavy development. actually there is no inheritance support nor pointers, so actually is a bit limited. but the developer is really active, and those features will be supported in the next versions as i’m helping him. i’m happy to help where there is the need, mainly on young projects runned by skilled coders.

sure i can stick with c++, i’m doing it all the time…


I’m curious. Does AngelScript compile down to a type of bytecode and is run in an AngelScript VM, or is it compiled down to native, or does it do a combination?

the script is compiled in bytecode with native function calling convention, runned through a asm written VM (one for every cpu). in the works there is the possibility to generate native machine code, or do just in time compiling, or both. for this feature we should wait a bit more tho…
the interesting thing is that registering a C function to the engine is very straightforward. you can specify the calling convention to fit the one of your function, so u don’t have to build a wrapper function like in lots of other engines:

[code]int callFunction (const int x, const int y) { /* … */ }

int myWrap (asArgs* args)
int x = args[0];
int y = args[1];

int ret = callFunction (x, y);

args->pushReturnValue (ret);

return 1;

but you just register your function directly, specifying if the engine should treat that with cdecl, stdcall, thiscall, cdecl with a object pointer last, or first (to easily tweak a function to be a method as well). so you would just do:

without having to wrap the function with another function which signature is know to the engine. in addition you can write your functions that will override practically all the operators known, so you could just do string concat with operator + or if you want you can use the same concat function with operator << or even <<=.
also you can manage how objects are created from the script since you have full access of the memory function for allocating and deallocating objects: in this way you have control over objects lifetime, you can add reference counted object which lifetime will be defined by the engine, or you can override the allocate/free operators so an object created through the script which will not be deleted when the script finished the execution, so it will live into the application memory. is very useful have control over that.

Using boost::python:

  • to bind a function, such as your callFunction example:
namespace py = boost::python;
py::def("callFunction", &callFunction);
  • overriding operators is equally easy, here is a pseudo class example:
namespace py = boost::python;
    .def(self + int()) // for if there is an operator+(int) override
    .def(self - anotherClass()) // for if you can subtract another class to this
    .def(self < other<expensiveToConstructClassOrWhatNot>()) // for the less then with a class that is expensive to construct or is not default constructable

and so on…

  • creating object ownership can be handled anytime it crosses script/native boundries with call polices. Here is a copy/pasted simple example from the tutorial:

No, I am not espousing python, but rather boost::python. boost::python is also used as the base for luabind (with simplier syntax since lua does not have classes and such). The code is actually rather language independent and you can replace the background python parts with whatever. You should have him use it as a base for his registering code. Even for the little def(“functiondef”, &functiondef) above, it adds full type checking. In your example function it takes two integers, if the python script passed a string or function pointer or whatever else that cannot be cast to an integer, it throws an exception stating that boost is expecting an integer (something which no python glue code does except for boost::python), so you would not need that weird signiture in a string syntax I’ve seen elsewhere.

Back to my series of questions though: How does it handle memory, does it use a pool, or does it allocate globally, or does it allow the register code to define allocators (boost::python uses either a pool, or define your own allocator, with an optional callback for python side garbage collection when python is done with it so you can deallocate it)? Does it have a concept of classes in-reality, in other words, are classes, right now, just a struct in memory and that is why it does not allow inheritence? If that is the case then it would be relatively simple to create a virtual calling table which would fix the majority of the problem right there. If not, how is a class currently defined?

EDIT: Another question, what if you have overloaded functions, say:

bool f(int a)
return true;

bool f(int a, double b)
    return true;

bool f(int a, double b, char c)
    return true;

int f(int a, int b, int c)
    return a + b + c;

and default arguments:

int foo(int a, char b = 1, unsigned c = 2, double d = 3) { /*...*/ }

EDIT 2: Also, may as well throw this up, if you type “import this” into the python interpreter, you get this:

[code]>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea – let’s do more of those![/code]
The base code of conduct for python, should be used by many more languages (hinthint*). :slight_smile: