I have again updated the alpha version. Just redownload from the link given and install.
Most of the compiler anomolies have been addressed. A few IDE issues.
Changes:
-Constructors and destructors are now called for local classes
-Base classes (single inheritance) now supported
-Virtual functions now supported
-Base class variables work as expected
The 'oop1.src' example was added to the installation. It is the IntArray class.
Notes:
Constructors/destructors will only be called for class variables defined in a subroutine, including 'main'. Global classes shouldn't have virtual functions as the vtable will not be set up. Arrays of classes will not have constructors called yet, except for the first object in the array....not that there is every much call for that sort of thing.
A constructor is a class function which has the same name as the class
A destructor is a class function which has the same name of the class preceded by an underscore
Virtual functions (overridables) must have the same parameters in each base class for which it is defined, which is normal in OOP languages.
There is no NEW or DELETE operator yet. Hope to have that finished in the next update.
I will post a real example of virtual functions after work today. Buf if you want to experiment here is the layout of on object with a base class and one virtual function.
class baseobject
{
//the class constructor
baseobject();
//the class destructor
_baseobject();
//a virtual function
declare virtual Calculate(float value),string
//member variables
float m_fvalue;
int m_ivalue;
}
class MyObject : baseobject
{
//class constructor
MyObject();
//class destructor
_MyObject();
//a virtual function
declare virtual Calculate(float value),string
}
Have fun,
Ionic Wizard
Anyone try out this update?
I compiled the OO example, worked fine. Just came back to Uni today, so not had much chance to play yet. ;)
Yeh all works fine at the moment Paul.
Will try my little #include problem and see if it woks yet.
Lewis
I haven't had a chance, yet. I probably won't get to it untiil tomorrow because I've been away from the computer most of the time. I'm very excited to try it out, though.
class Lexer {
declare Lexer(string filename);
declare _Lexer();
int file;
}
Lexer::Lexer(string filename) {
// Open the source file
this.file = openfile(filename, MODE_READ);
return;
}
The compiler crashed on this rather than reporting an error. Changing "this.file" to "file" fixed this.
"this" is a pointer, so you need to dereference it. *(Lexer)this.file = ...
I think the line in question actually was:
closefile(this.file);
Quote from: VirusScanner on November 13, 2005, 05:55:16 PM
"this" is a pointer, so you need to dereference it. *(Lexer)this.file = ...
I though this was a parsing bug, that's why I reported it - it crashed the compiler rather than my program. Thanks for pointing that out though
Well it should still report an error rather than crash the parser. So its good that you reported it anyway. But it is an Alpha so problems are not surprising at this stage ;)
Lewis
Would be nice if 'this' was assigned a type automatically in each class method though, since there's only one that it can be...
Never said I was finished ;)
Can only write so much code between work and sleep.
Found time to have a quick test witht the new update and my problem with the #include statement seems to have gone :D
Thanks
Lewis
Good to know.
I am trying to be very thorough with solving syntax bugs, so when we get to the beta stage we can concentrate on the larger issues. This is all a part of being involved with an evolving language. My other language was a private alpha, hidden from view and only a select few allowed to participate. I never liked that but my hand was forced by outside parties.
Documentation will come with the betas for those of you that prefer reading before programming. Haven't decided whether I want to stick with htmlHelp or try something new this time. htmlHelp has some limitations, such as not being able to link into Windows context sensitive help messages. The htmlHelp compiler is an absolutely horrid piece of Microsoft bugware.
Paul, for doc development and disitribution, TreePad is dual-platform Win and Linux, has free version adequate for accumulating info and structuring it, reasonablel-cost pro version with bells and whistles, has free reader for file distribution, also makes standalone EXEs with reader embedded. It would be a good doc starter, until Aurora gets up to where you can do a built-in doc handling like Fletchie's iBasicHelp system.
Cool, IDE options work now, except a few more are needed: number, character, operator. Also font and style settings aren't implemented for each item. I assume you already know though.