OO Programming in PureBASIC ????

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
idStefke
User
User
Posts: 25
Joined: Sun May 04, 2003 10:01 pm
Location: BELGIUM

OO Programming in PureBASIC ????

Post by idStefke »

Dear Support,

Have you plans in the next upgrade (Major) or an new version support and buildin OO programming
- used classes,
- instances objects
- interfaces
- properties
- methode

- the concepts
encapsulation
inhertance
polymorfisme
overriding
overloading
abstract classes
constructors
destructors

like all the very modern programming languas RealBASIC, VB.NET,
Borland Delphi, C++ Builder ?

I would like building and creating my own classes or components in
PureBASIC

Kind regards
Stephane
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

For all: no. It's a BASIC dialect. But I will do an 'Interface' like structure to access easily the COM/DX components from PureBasic.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Post by Danilo »

idStefke, see also the Topic: CallCOM() / CallDX()
and SEARCH the Forum for 'CallCOM(' -> 23 matches you should all read.
cya,
...Danilo
...:-=< http://codedan.net/work >=-:...
-= FaceBook.com/DaniloKrahn =-
lanael
New User
New User
Posts: 5
Joined: Wed May 14, 2003 8:31 am

Post by lanael »

Really sad to not have just a bit of object stuff...

Only object definition and instantiation would not kill the basic "spirit".
I think we not need inheritance, overloading or other concepts of true OOP...

No chance(s) ????

edit : I'll do buy PureBasic if only.... :)
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

>Really sad to not have just a bit of object stuff...
>Only object definition and instantiation would not kill the basic "spirit".

this is possible, see the first post by danilo here:
viewtopic.php?t=6050

Also most of what you use objects for can be accomplished using structures, only they have no (member functions) methods, which is no big deal.
--Kale

Image
lanael
New User
New User
Posts: 5
Joined: Wed May 14, 2003 8:31 am

Post by lanael »

I understand that's possible and this is really a clever but a ugly hack !
Also most of what you use objects for can be accomplished using structures, only they have no (member functions) methods, which is no big deal.
I know that, I've coded like that in "Omikron Basic" on Atari ST ...err... 12 or 13 years ago ! :)


I think about something like :

Object zz
i.w
j.l
helloString.s

Procedure init
...
End Procedure

Procedure destroy
...
End Procedure

Procedure SayHello
PrintN( helloString )
End Procedure

End Object

o=new(zz)
o\init()
o\SayHello()
o\Destroy()
delete(o)


Doesn't this look like PureBasic code ??
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

I must admit that object idea is interesting and i imagine hard to include in PB :twisted: , i think Fred has made his mind up about this.
--Kale

Image
lanael
New User
New User
Posts: 5
Joined: Wed May 14, 2003 8:31 am

Post by lanael »

ah at last !

Fred ! Fred ! ya moyen ?
dis...
hein...
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post by tinman »

lanael wrote:Really sad to not have just a bit of object stuff...
Well, you could always do OO in a similar way to how it is handled in Windows or AmigaOS - put your class in a DLL or library and send messages to the object or dispatcher function.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

Kale, Fred, Kale, Fred? Kale "seems" to know a lot :wink:
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

>Kale, Fred, Kale, Fred? Kale "seems" to know a lot

And your point is? I enjoy good debate, and like to participate in these forums, is this not allowed? I admit i have only been programming a few years compared to some here and know only a few languages but when has giving an opinion on a public forum as a registered user and customer been something to be personally attacked about? I try to help where i can and stay quiet when things are over my head!

>I must admit that object idea is interesting and i imagine hard to include in PB.

This was meant to mean that i was interested in the idea and didnt realise how close to the PB feel lanael's code looked.

>i think Fred has made his mind up about this.

Was meant to mean i agree with Fred not including any OOP in PB (it is BASIC after all) and to let lanael know in a polite manner that Fred has made a concrete decision on this!

Are you still smarting from that OpenGL jibe here?:
viewtopic.php?t=6131
--Kale

Image
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

Kale: "I enjoy good debate...". Well OK let's go!...

Sure, your allowed an opinion just as I and others are. It's the manner and the speed with which you jump to trash someone elses request/ suggestion. It's the way you qualify such "opinions" by always tagging on "...and Fred says/has <fill in the blank>" as if you are some self-elected spokesperson and holder-of-the-keys. My *point* is: I have a "thing" especially about people who are so very quick to attempt to deny others what they seek because it is something they themselves cannot appreciate and/or simply because *they* do not need it, typically expressed as "the language does not need it", as if THE LANGUAGE is something sacrosanct. The most annoying argument is the "I have no use for X" with the implied "therefore no one should have X" and even more so where feature X has *ZERO* impact on anyone but the person/s requesting it. I'll stop here and save something for the diatribe that usually follows.

PS: I once spent a whole weekend on the BB3D forums arguing for DLL access against the wishes of several people who either had no use for it (and so shouldn't have been involved anyway) or could only spout "...but Mark said this...". Come Monday morning... new release, DLL access and I haven't heard a single person complaining since.

PPS: "Are you still smarting from that OpenGL jibe here?: " - What? I probably did not even realise it was a jibe... well ok I did but I let it slip since you were (inadvertently?) stating a *fact* that applied to all three, as well as being a major advantage (essential no?) for a supposedly cross-platform language.

And now the almost obligatory... :lol:

"Always end an ass-kicking with a smile(-ly), they're guaranteed to come back for more!" - dmoc 030514 2336 - created especially for this post.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

>It's the manner and the speed with which you jump
>to trash someone elses request

I've never 'trashed' someone's request! Show me a thread where i have? This topic has been done to death, (search the forum) i was just commenting its an interesting idea but im comfortable with no OOP in PB.

>It's the way you qualify such "opinions"
>by always tagging on "...and Fred says/has <fill in the blank>"

All info i post is from taken from what Fred has posted. I read the forum a few times a day and always confirm what i'm posting by searching and reading other threads/posts from Fred himself, search the forum yourself or shall i provide links in the future. :roll:

>as well as being a major advantage (essential no?) for a
>supposedly cross-platform language.

See all Fred's posts about this here:
viewtopic.php?t=4669

I think you need to calm down, you seem to get annoyed if you don't get your own way or are not listened to. I only try to help point people to other threads and repeat what has been said before.

>Always end an ass-kicking with a smile

did i miss something here?
.......

Oh sod it im fed up with this, I'll not post anymore. cya later...
--Kale

Image
Magi
User
User
Posts: 25
Joined: Sun Apr 27, 2003 12:57 am
Location: Burlington, Canada

Post by Magi »

ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

If i can give my opinion about OOP.

I don't ignore that maybe someone could find it usefull for some purpuoses and i respect all points of view, but if we talk about GUI let me say PLEASE DON'T CHANGE PUREBASIC TO OOP!!!

I come from OOP languages (VB, Delphi, RapidQ, etc) and at the first time maybe i miss OOP but now, after trying the 'sense' way that PureBasic uses i can't feel that its a lack, its an advantage not to have it.

Just see:

Code: Select all

For i = 0 to NumOfGadgets
  SetGadgetText(i,"My Gadget Num: " + Str(i)) 
  State(i) = GetGadgetState(i)
  SetGadgetState(i) = NewState(i)
Next i
This is simple, clear, easy and beautifull!!

Try to do the same in VB or Delphi he he (you will need to cal collections, etc.)

The syntaxis

Gadget(Num,x,y,W,H[,text,flags]) is clear, concise, makes sense, its easy to remember, need less typing, etc.


The same for the way we enable disable, etc. gadgets.

The style:

Button1.Left = 10
Button1.Top = 10
Button1.Width = 100
Button1.Height = 20
Button1.Caption = "My Button"

Seams obscure and obsolete for me.

One of the many reason because i love PureBasic is its easy, readable, logicall, (how can i say: understable in english? :?) etc. way to manage the GUI.

Of course MY way and MY point of view i just mine and i do understand if some one is not agree and if someone want to use OOP for other purpouses, but please don't forget (im talking to Fred rightnow) that some of us LOVES the PB way to manage the GUI.
ARGENTINA WORLD CHAMPION
Locked