Functions in Types?

Previous topic - Next topic

Kitty Hello

Uhm, well.
I don't like it. I won't support it much, but you asked for it until my ears were bleeding.

First, the TYPEs should soon be able to have functions as members as well as a "self" variable pointing to it self.
Code (glbasic) Select

TYPE Tvec
   x;y;z
   FUNCTION null:
      self.x = 0; self.y=0; self.z=0
   ENDFUNCTION

   FUNCTION add: v AS Tvec
     INC self.x, v.x
     INC self.y, v.y
     INC self.z, v.z
   ENDFUNCTION
ENDTYPE

LOCAL vec AS Tvec, vec2 AS Tvec

vec.null()
vec.x=50
vec2.x = 100
vec.add(vec2)


Also, I think about including the AS standard types: double, float, int, short, char.

It will be a version 8.x upgrade. We have 7.x for about a year now - time to increase the version number :P


Here's a beta patch of the GPC you need. If you're uncertain how to install it, don't!
Do backup before you replace it. I've built some old projects ok with it, but there was times when it made really nasty and hard to identify errors. Be warned. Don't use it for an AppStore release unless you really thoroughly tested the output.
http://www.glbasic.com/beta/platform.rar

Quentin

lol

GREAT!

but you'll regret it, I'm sure.
don't forget to offer PRIVATE, PUBLIC for TYPE members :)))

gregbug

yeeeaaahhh!!!!
thanks!
Ciao Ciao,
Gianluca. (l'Aquila tornerà a volare alta nel cielo!!!!)

Scott_AW

Functions in types?  Interesting...

I like that part about standard types, I was kind of missing those.
Current Project, Orbital Contract Defense
http://gamejolt.com/games/adventure/code-name-ocd/9887/

BlackShadow now open source/resource(requires duke3d)
http://gamejolt.com/games/adventure/black-shadow-3d/9885/

bigsofty

Not keen on functions in types, start of the slippery slope down OOP  :puke: ... but I do know folk want it.

Quotedouble, float, int, short, char

Now this is something I would like to see, its a definite step to towards easy C library compatibility, which would open a whole world of possibilities for me.

Congrats Gernot, nothing easy to do in that post, much appreciated!  :enc:
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

doimus

 :booze: :enc:

[attachment deleted by admin]

Schranz0r

#6
 <3 I love you!  <3
  :happy:  :nw:

On your post you forgot the white flag gernot ;) -> :giveup:


Thank you so much!

Edit:

You implement this feature on your GLBasic version, and it work?!
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

Kuron

QuoteOn your post your forgot the white flag gernot
Based on Gernot's feelings about the new feature, it is more like  >:D

Schranz0r

 :D also a good smily :D
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

aonyn

Ah, nice Gernot, that will allow more OOP style with methods.
Please though, don't allow OOP to take over to the point it is required.
OOP is great when it can be used as a tool as needed.

Thanks.

@ Schranz0r - I just want to mention, I love your avatar, it makes me smile everytime I see one of your posts.  =D
Did you make that character?

regards,
Dave
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. -Ephesians 2:8-9

Schranz0r

Quote from: aonyn on 2010-May-01
@ Schranz0r - I just want to mention, I love your avatar, it makes me smile everytime I see one of your posts.  =D
Did you make that character?

No i find that picture in the WWW :)
Thats my ABSOLUT FAVORIT Avatar :)
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

aonyn

Haha, just smiled again  =D
Definately one of the best avatars I have ever seen.

regards,
Dave
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. -Ephesians 2:8-9

Schranz0r

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

Kuron

I am rather partial to this ostrich head:


aonyn

For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. -Ephesians 2:8-9