It's possible have short int, unsigned int... ETC

Previous topic - Next topic

mentalthink

Sorry because I don't know if this has questioned yet.... but...

It's possible using INLINE to have short, unsigned Int and all the C++ datatyped obviously whit another name but using directly into the standard Code...

I try something using Types and Inline between Type and Endtype, and using the Preprocesor Compiler variables, but my C++ Skills for now are very limited...

I say this because perhaps for don't waste memory can be usefull, and I think Real Basic can do...

Regards , and sorry if this question it's repeated...


mentalthink

Hardyx thanks a lot I think whit this kind of types make a translations for 3ds loaders or another kind of data like a TGA loader can be very easy....

Thanks Hardyx a lot...

PS: Only like a counsil, I think this it's very important to put in the Official Help of GLBasic

kanonet

It still would be usefull if we could use inline to add some more features to types. I want to add pointers into types! I want to add constructors/deconstructures into types! Maybe i even want to add operators, function/operator overloading, inheritance etc... but i guess you would say, that this isnt basic anymore... but at least pointers and constructors schould be in GLB, it would not make life harder for those that do not need it, but would help us advanced coders. Too bad i cant add things like this with inline.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

mentalthink

Yes kanonet this will be nice, but perhaps it's too much complicated for a Basic, I now I understand a bit about this things, but when I bought GLbasic , really a lot of things were extremelly complex, for good programmers like you perhaps all it's very easy, but for poeple begin to program whit Glbasic...


kanonet

I know this point, but I dont fully agree on it. Of cause having more options can cause a little bit more confusion, but if you dont understand one command you can just ignore it and still code nice games without it. I think having more features is better then having less, so everyone can find and use what he needs.
Besides - for me it would be totally ok if these features would not be in native GLB command set but would be prepared that we can easily use them with inline. But ATM its not possible to add something to a type unsing inline (at least i failed trying).
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

kanonet

Yes i agree this is the harder way of doing it (but the GLB precompiler could be written to handle it [before everything gets turned into C++], especially if we get a few keywords) and it would not be very nice looking/easy understandable. So i just suggested this in case it would not be done in native GLB commands. But native commands could be done easily i think:

Code (glbasic) Select
TYPE Ta
  a%
ENDTYPE

TYPE Tb
INHERITANCE Ta // inheritance Ta so now Tb als has a self.a etc...
  b%
  FUNCTION ON_CREATE:
    self.a = self.b
  ENDFUNCTION
ENDTYPE

A function ON_CREATE inside a TYPE gets automatically turned into a constructor and code inside it that will get copied at the end of GLBs intern constructor of this type/class.

LOCAL c as {type}* = pointer pointer of named type, like:
Code (glbasic) Select
LOCAL c% // its the same as LOCAL c AS DGNat
LOCAL d as DGNAT*
d = &c

I all cases the names and signs are just examples but you get the idea - and you already know this from c++. ;)
Inheritance and constructors should be very easy to implement and still look like basic, pointers are less easy but i think more important since they are really powerfull. Btw since pointer are in c++ they should not need to be in GLB it would be enough if the GLB precompiler would not complain about them. This way they would not be in GLB (and not confuse newbes) and we could use them without inline and inside types.
Just a few ideas, i think it could be done and i would be willing to help making it possible.
Btw how do other basics handle this stuff? Do they offer these features and if yes: how?
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

kanonet

I know. :(
Btw if I remember right, it was said that we never get functions in types... but we got it. So there still is hope, even if it isnt much.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Schranz0r

Quote from: Ocean on 2013-Aug-22
others have tried to convice Gernot of adding OO mechanisms.  He never gave in...

who was that guy?  :-[
Whip him!  :whip:
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard