ClassBuilder
Displaying 21-32 of 32 total.
prev 1 2
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
zonker6666

I personally find it quite useable as it is - of course some refinements would be nice :)

lets see, a request or two ....

allow the classbuilder to build a series of files using a list.
perhaps it could create a barebones system.vc that would already have the project classes included
operator overloading? :)

Posted on 2004-10-13 07:55:36

gannon

oh also if it is not too much trouble could you add multiple init functions per class.
I agree it is great as it is but it is even more great that you still have interest in it.

Posted on 2004-10-13 09:30:48

Feyr

Creating a new copy of system.vc is a good idea, but it would only be able to do so the first time you generated code...otherwise there would be the risk of overwriting changes that have been made to system.vc. I think this is pretty much covered already if you do something like this:

// in system.vc
#include 'ClassBuilder.vc'

// ClassBuilder.dma
#include 'Class1.dma'
#include 'Class2.dma'
// ...
#include 'ClassN.dma'

// and running ClassBuilder.dma through the generator would
// also deal with Class1.dma through ClassN.dma, generating...
// ClassBuilder.vc
#include 'Class1.vc'
#include 'Class2.vc'
// ...
#include 'ClassN.vc'

int TypeCheckErrorHandler(blah blah) {
}

string TranslateTypeIDToClass(int typeID) {
}

// other global functions

The main reason I think it needs to be done like this is that I'd like to have a single error handler and type ID translator for the entire set of classes. As it is now, there's a type ID translator for every .dma file (which means that classes don't know the human-readable type names for anything outside their file), and no central type check error handling at all. In order to do this, all of the files have to be dealt with at the same time. I suppose it would be possible to have it store type data in a special file somewhere so that future .dma files would have access to it, but you'd end up accumulating a lot of old class data if you renamed or no longer used some. I'll look into it and see what I can do.

Operator overloading is something I hadn't considered, but it would be quite cool. I don't see any major barriers with it, assuming I can do a reasonable job of finding VC function headers, parameters and local variables, which would require some assistance from the user...either something like the current InheritCode format, where each Code block is only allowed a single function, or requiring that function signatures are all placed on a single line to keep me from writing a full VC parser. Like this:
'int SomeFunction(cObject obj, cStuff stuff, string thingy) {'
instead of
'int SomeFunction(
cObject obj,
cStuff stuff,
string thingy
) {'
or whatever. I'm hesitant to put requirements like that in, because I'm sure at some point I'll forget and do it wrong. And changing the requirements of Code blocks would break code that already exists (I'm planning on trying to support the old $Class.Instance.Field$ format as well as the new $Instance.Field[.Field]*$ format.

Another concern is that it could make it difficult to do something like:

cObject ptr_to_object = some_object;
int offset = CLASS_cObject_FIELD_Stuff;
int stuff = dma.quad[ptr_to_object + offset];

Technically that would be easier to write as
int stuff = $some_object.Stuff$;
using the new syntax which includes type checking, but if someone did try to access the fields manually then they'd get unexpected results if the 'cObject + int' operator was defined, as it would be rather difficult to distinguish between additions indented to modify the pointer and additions intended to modify the object being pointed.

I think a note in the docs to that effect should suffice, though.
----
Anyway, since it's apparently just the three of us using/planning to use this, let me know what you think about breaking old code to allow for new features.

Multiple Init functions is no problem, provided you give each one a different name. No function overloading in VC. =(

Posted on 2004-10-13 13:16:30

zonker6666

As far as im concerned if it needs to be broken to be made better - break it :)

Posted on 2004-10-13 18:09:47

gannon

hehe why don't you combine operator overloading and multi init function.
The reason I asked was because there was a limitation on the number of init functions in the older version.
If it is not backward compatible I do not mind. I feel that the want for backward compatiblity bogs down too many things that could be made better if they were not concerned with that.

Posted on 2004-10-13 19:59:59

Feyr

Quote:Originally posted by gannon

hehe why don't you combine operator overloading and multi init function.


Operator overloading isn't the same thing as function overloading. Function overloading would be like this:

int MonsterNew(string stat_file) {
// Load monster stats from a file
}

int MonsterNew(int MaxHP, int Strength, int Defense) {
// Use the supplied values for the monster stats
}

which is something Verge just won't allow.

Operator overloading is where you write special functions to handle cases where you use classes with the builtin operators, like +, -, * and so on. Like this:


Class:StatBonus
Field:StatID:byte
Field:BonusAmount:sword

Operator:StatBonus += StatBonus
if($first.StatID$ != $second.StatID$) {
Log('Can only add stats with the same StatID!');
return;
}
$first.BonusAmount$ += $second.BonusAmount$;
EndOperator

Operator:StatBonus += int
$first.BonusAmount$ += second;
EndOperator

With something like that, you could write code like this:

$weapon.StatBonus$ += weapon.RuneBonus$;


and have it add whatever bonus the weapon's runeBonus field (which is of type StatBonus) to the weapon's bonus.
Compare with this code that does the same thing without operator overloading:

int runeType = $weapon.RuneBonus.StatID$;
int statType = $weapon.StatBonus.StatID$;
if(runeType != statType) {
Log('Can only add stats with the same StatID!');
return;
}
$weapon.StatBonus.BonusAmount$ += weapon.RuneBonus.BonusAmount$;


Which makes things a lot more concise. I think I may end up implementing arbitrary operators as well, so you can come up with more meaningful relationships than '+', '-', '*', etc. That's something I've always wanted for C++. So you could do, like:


Rectangle r1,r2,r3;
// Do stuff with r1 and r2
r3 = r1 intersect r2;
// r3 is now equal to the overlap between r1 and r2


You'd have to be very careful about using that feature, since the parser could get confused if you're unlucky. But I expect to be able to find the types of all typed locals and parameters at compile time, and only applying the overloaded operations that actually exist, so the chances of you accidentally (for example) writing a string that has a valid operation in the middle of it that gets expanded are slim. And if you come up with some kind of convention for naming operators and stick to it then your chances of having your code survive are a lot better.

Yeah, I think I'm going to have to break the old style Code blocks in order to make operator overloading work, and after that example I'm more convinced than I was before that it's a good idea. ;P Shouldn't be too much trouble to fix up old code...the old style field references should still work, and the only change I anticipate being needed for the Code blocks is to put the function header on the first line, as InheritCode blocks already do.

Posted on 2004-10-13 20:38:13

gannon

yes that is correct. I forgot about operator overloading. I was confusing it with function overloading.

Posted on 2004-10-13 20:48:40

zonker6666

I have a further suggestion. It is certainly something that isnt an immediate concern but I got to thinking when you mentioned that only us 3 are actually using it -- it was further reinforced by some comments I got concerning the class builder from other vergers ---- basically 'I don't get it' :)

So the suggestion would be to come up with some sort of development environment for it -- color coding -- maybe a visual way of defining a class -- some help :) -- project management etc ...

What do you guys think?

Posted on 2004-10-14 03:43:07

rpgking

Instead of a development environment, why not just make a Textpad syntax definition file for it?

Oh, and btw, I'm actually interested in using ClassBuilder myself, since I basically learned the bulk of my programming with Java which is strictly object-oriented. So, there'd be more than 3 people using it ;)

Posted on 2004-10-14 08:27:10 (last edited on 2004-10-14 08:29:22)

Feyr

Yeah, McGrue suggested a web-based wrapper around the script. I was reading PHP docs today, and it's basically Perl with a couple new conventions. I could probably come up with something fairly quickly in either PHP or VB. For that matter, I could write a Perl app that manipulates an instance of Internet Explorer to develop classes visually...I did a little bot in Perl once that ran around the web and gathered up all the stuff I wanted to keep track and modified a page in real-time to keep it updated. The script took commands off the page, too. Hmm.

I was thinking of something like Microsoft's Visual Studio class view, where you get a little tree view of your classes with all the fields and functions listed.

Unfortunately I won't have time to work on it until at least Wednesday, and I'd like to get the next version of the program itself done first. Spending time with the girlfriend (^_^) and taking midterms (;_;)

why not just make a Textpad syntax definition file for it?
Not a bad idea, though there's not a whole lot of keywords specific to the generator itself. About a dozen or so, I think. And that wouldn't help the problem of people not understanding the point of the program or how to use it. I guess my examples and docs weren't clear enough.

I picked up some webspace to hold my projects and stuff on, so I'll probably convert the docs into HTML and set up a walkthrough or two that might help. I guess some people just don't like to wade through ten pages of plain text interspersed with code. *snicker*

Posted on 2004-10-14 10:39:19 (last edited on 2004-10-14 10:44:24)

zonker6666

Thought i'd show you guys what I've been working on :)

Seeing as you've been on the windowing library feyr I decided to work on a little menuing set of classes.


Posted on 2004-10-15 20:22:01

Feyr

Hey, that looks pretty cool. Ring selection menus are nifty. Is that a Diablo-style overlay map in the bottom picture?

Anyway, I've finally gotten a chance to work on ClassBuilder some more. The new version isn't complete yet (it doesn't generate any code yet, but all the data structures except for the operator overloading stuff are in place), but it does generate cross-referenced HTML docs for everything I've done so far. You can find a sample on my site. All of the pages there were generated by ClassBuilder v3, as was the default CSS stylesheet which gives the pages that very manly pastel motif. ;P The source file that the pages were generated from is also up there, but it's just a mish-mash of tests and gibberish.

The inheritance hierarchies are all displayed on the main page, and clicking on any class name will take you to the detailed class documentation. Look at TestClass for a lot of stuff involving variables, multiple destructors/constructors, and the like. The Living hierarchy (which includes Monster, Player and Legend) is mainly for testing inheritance, function overriding and default constructor/destructor generation. Once I get it generating docs for the operator overloading stuff I'll add in code generation so it'll actually be useful. Unfortunately I'm running into midterms and school projects right now, so I'm only able to steal a few minutes between classes every now and then.

Posted on 2004-10-21 07:27:40 (last edited on 2004-10-21 07:37:45)


Displaying 21-32 of 32 total.
prev 1 2
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.