forums

TNT Basic Forums > TNT Basic - The Open Source Edition
TNTBasic NOW HAVE STRUCTURES!!!
< Last Thread     Next Thread >
Author
Thread        Post A Reply

04-21-2007 03:29

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

Sure, its a bit primitive, when you have to add variables 1 by 1 instead of being able to define them 1 at a time. but the point is, my struct implementation (from limited tests) appears to be able to achieve good speed.

Copy this text at: http://appleide.sitesled.com/newfile.txt

Make a new project, paste code, run.

It initiated as a comment from a person on the net saying to me "It is possible to simulate OO features into any sufficiently complete language". However, it turned out TNTb was not 'sufficiently complete', and I was only able to achieve implementing "Structures". And these Structures I have made aren't the same as the ones you normally use. read the example code.

If you don't know what Structures, here is a brief description.
Imagine you can create a new type of variable that contains more primitive variables like "int, float, char, string".

for example, I'll have:
boat, which contains, "speed, color"
its "speed", is an int variable, belonging to the boat. it can be changed (in Java, if we're talking about objects) as boat.speed=10 and boat.color=blue

In the Structures I have built, you create a new instance of such a thing like the boat I have mentioned. You then write variables into it. These variables can be returned and/or modified. You can also duplicate a structure. Note that instead of having a "template", all definitions are at the same time declarations. (don't worry if you don't get this).

04-22-2007 07:22

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

I have managed to decrease the speed-cost of using this in your program by a factor of however many structs there are. If I manage to do this again, then the speed will become equal (o_0) to not using this at all!

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.