Page 1 of 6
Easy object oriented programming (just look at my example)
Posted: Thu Mar 03, 2005 9:37 pm
by Joakim Christiansen
I know that OO have been suggested before and Fred said no.

But what i'm suggesting is that Fred makes his own version of OO.
Something like my "fantasy" example down there is using:
Code: Select all
; Define a structure
Structure str_bullets
x.w
y.w
EndStructure
; Define the object
Object Player
NewList lst_bullets.str_bullets
x.w = 320
y.w = 240
Procedure MoveLeft()
x - 16
EndProcedure
Procedure MoveRight()
x + 16
EndProcedure
Procedure Draw()
DisplaySprite(#spr_Player, x, y)
EndProcedure
EndObject
; Create Player1 as object Player
NewObject player1.Player
; Example of things you could do with the object:
player1\MoveLeft()
player1\MoveRight()
player1\x = 10
player1\Draw()
AddElement(player1\lst_bullets())
player1\lst_bullets()\x = player1\x
player1\lst_bullets()\y = player1\y
DeleteObject player1
The object in my example has local variables and structures inside it, also a local list with a structure. Just to show a little of what I think would be possible.
Would this realy destroy the BASIC dialect
The reason why I would want something like this is because I think it would make game programming much easyer.
And it would also make PB more proffesional and complete.
I'm sorry if this have been discussed to many times before and I should just shutt up.

Posted: Thu Mar 03, 2005 9:55 pm
by Psychophanta
Yesssss. I voted yes.
But i would replace some things:
Code: Select all
; Define a structure
Structure str_bullets
x.w
y.w
EndStructure
; Define a class
Structure Player
NewList lst_bullets.str_bullets
x.w = 320
y.w = 240
Procedure MoveLeft()
x - 16
EndProcedure
Procedure MoveRight()
x + 16
EndProcedure
Procedure Draw()
DisplaySprite(#spr_Player, x, y)
EndProcedure
EndStructure
; Create Player1 as object Player
player1.Player
; Example of things you could do with the object:
player1\MoveLeft()
player1\MoveRight()
player1\x = 10
player1\Draw()
AddElement(player1\lst_bullets())
player1\lst_bullets()\x = player1\x
player1\lst_bullets()\y = player1\y
Posted: Thu Mar 03, 2005 10:36 pm
by blueznl
psycho, i'm not entirely in favour of objects and oo stuff, but that makes sense, the thing you created there, and it stays readable and (from fred's point of view, i might guess

) somewhat manageable... i could be wrong though, that has happened before

Posted: Thu Mar 03, 2005 11:56 pm
by Psychophanta
Posted: Fri Mar 04, 2005 12:10 am
by SR-Games
A big NO from me. OOP is great, but it has no place in a BASIC language. Sticking OOP in a BASIC language completely defeats the purpose of using a BASIC language. There are plenty of good OOP based languages out there.
Posted: Fri Mar 04, 2005 12:30 am
by Psychophanta
SR-Games wrote:There are plenty of good OOP based languages out there.
Yeah! Some of us hope PureBasic is added and surpass most of those languages and in a near future

Posted: Fri Mar 04, 2005 12:33 am
by Rescator
Doesn't BASIC stand for Beginner's All-Purpose Symbolic Instruction Code ?
(had to look it up, I knew this way back but forgotten now

So I'm saying nay to OO suggestion
I saw what it did to PHP (PHP5) and don't like it, nor do I use it. (the OO stuff that is)
Posted: Fri Mar 04, 2005 12:49 am
by SR-Games
Please don't get me wrong, I like OOP and use C++ Builder 6.0 Enterprise for all contract work, and I even like Jamagic for apps & 2D because of its OOP. But I am an old-schooler when it comes to BASIC and am a purist, BASIC should never be turned into a C++ wannabe language. (Heck, some purists would even argue that a BASIC language should always be interpreted, not compiled. (But since the expanded BASIC cartridge for my TI 99 4A was "compiled", I don't agree with that stance.))
Re: Easy object oriented programming (just look at my exampl
Posted: Fri Mar 04, 2005 2:15 am
by Blade
Joakim Christiansen wrote:
Something like my "fantasy" example down there is using:
Your example is very similar to the Actionscript used in FlashMX, IMHO it's a really cool way of coding! The problem is that you are limited to the "flash world", can't create general purpose applications...
Some one could say that it's similar to Java too, but java is slow(er) and requires a bloated virtual machine.
I'd love that kind of language to create small and fast exes, but please don't contaminate "our" PB... you will obtain two parallel languages in one package, a big chaos!

Posted: Fri Mar 04, 2005 3:50 am
by Joakim Christiansen
My example was quite easy to understand, and that fetature would only make programming in PureBasic easyer. (basic is another word for easy)
How "BASIC" would you really want PB to be, we are not kids... (and you could choose if you want to use OOP any way...)
And if we can't add more advanced features to the language because it's named PureBasic, then change the damn name.
You should just see the "BASIC" on my Atari, that was much harder then PB.
Re: Easy object oriented programming (just look at my exampl
Posted: Fri Mar 04, 2005 3:55 am
by PB
> The reason why I would want something like this is because I think it
> would make game programming much easyer
Then you should have bought an OO-based language in the first place.
Registering PureBasic and then casting votes to change it is a slap in
the face to everyone else who registered it for what it is. IMHO. And
I don't care if the Yes votes outnumber the No votes -- anyone who
voted Yes should have bought an OO app in the first place. They knew
what they were getting when they bought PureBasic so they shouldn't
be trying to change it and ruin it for others. You get what you paid for!
Posted: Fri Mar 04, 2005 7:28 am
by freedimension
I don't know how about the others of my fraction, but I think that conservative thinking of some people in here is a slap in the face of the other users that only want progress and improvement.
Don't get me wrong, but the given would be no change of the language but only an additional feature. We wouldn't force you to use it, we don't vote for PB to become a strict OOP-Language like Java or C#. This wouldn't hinder you to program old style "BASIC" (though I'm asking myself what's so BASIC about PureBasic? The name?).
All we ask for is BASIC support for OOP. And don't get me wrong, but there sure are a lot of other BASICs out there that already have a crude implementation of OOP. Take VB(6/.net) for example. Even the most basic of all languages, Assembler has nowadays build in OOP.
Posted: Fri Mar 04, 2005 8:17 am
by blueznl
i guess there are four views...
1. stay pure (no oop)
2. go fancy (psycho's style oop which is akin subroutine calling with just a different name)
3. do real oo support (just minimalist so we can use all new xp and the like stuff)
4. go all the way oop (full featured full fledged)
to me, a combo of 2 and 3 would be great!!! i don't need full stuff, but the way psycho described it does make programming easier, all you have to think of is the procedures within the object are just procedures... just easier maintained, yeah, i can see a point though not the light yet

Hmm
Posted: Fri Mar 04, 2005 9:07 am
by Fangbeast
Frankly, I don't give a flying hamster's bottom if PureBasic has OOP or not as long as..
a. The commands that I love and use daily are still in there
b. The libraries of commands I use stay lean and not get bloated into my final executable because of 'feature creep'
c. All this extra stuff that I don't use has no impact in speed and size on my final product
I believe someone said (I didn't count it) that there are over 400 commands in the current purebasic and I only use maybe a 1/4 of these. The 3/4 that I don't use are not compiled into my final program (I checked), do not slow down, nor bloat my application as the compiler is smart enough (and the libraries are split enough) to not compile in what I don't use.
I believe that as long as the compiler is designed in this clever fashion, it doesn't matter what is added to the language because what you don't use will not impact on your final product and that's the bottom line for most programmers.
Visual Basic is a good example of a product with feature creep in gargantuan proportions necessitating huge runtime libraries, form caches and a gazillion functions ready for each application that will never use them.
To illustrate the point a few years ago, I downloaded a home inventory package totalling 8 meg in size and wasn't very impressed. VB6. Recoded the same thing with a few more features in 80K in PureBasic and most of the size was the graphic buttons. Recoded it with PB3.92 recently and only added 4k with the new lib structures, really good stuff and impressive as hell.
The way PB is designed, I think that anything could be added to it with the same compiling logic and that is good for people of all programming languages and I could still get my 84k program out of it in the future.
Re: Easy object oriented programming (just look at my exampl
Posted: Fri Mar 04, 2005 9:40 am
by Psychophanta
Blade wrote:I'd love that kind of language to create small and fast exes, but please don't contaminate "our" PB... you will obtain two parallel languages in one package, a big chaos!

THEN: What do you think about inline ASM and FASM assembler interface (using ! prefixes) ? Aren't already
two parallel languages in PB now ?
Well, i must said and repeat again just what Freedimension wrote. Agree with him and agree with Joakim.
About the four views explained by Blueznl I would choose 4.
NOTE: Probably i would never use OOP stuff. For my needs it is not needed
