Classes in PureBasic
Re: Classes in PureBasic
What's a "module"?
Re: Classes in PureBasic
A module have protected var-, procnames, like a userlib.rsts wrote:What's a "module"?
You can export vars, functions and so on.
No more conflicts in includes, if you use module.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

-
- Addict
- Posts: 1518
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: Classes in PureBasic
Can make a class, very similar to module.
Code: Select all
DeclareClass Test
; Public elements.
Global x.l
Global y.l
Declare Plus()
EndDeclareClass
Class Test
; Private elements.
Global z.l
Procedure Plus()
Result = x + y
z + Result
ProcedureReturn Result
EndProcedure
EndClass
x.Test ; Create an instance of class.
x\x=2
x\y=8
Debug x\Plus() ; Return value 10.
Re: Classes in PureBasic
So not gonna happen. 

Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
-
- Addict
- Posts: 1518
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: Classes in PureBasic
Well, why not? This corresponds to the concept of PB and if Fred and the team will do so, it would be great.
Time is now, programming in style OOP, complicated and confusing.
Time is now, programming in style OOP, complicated and confusing.
Re: Classes in PureBasic
Because Fred doesn't want to. As sad as this is, it won't happen any time soon.User_Russian wrote:Well, why not?
There haven been discussions about adding OO support for years, the answer has always been the same.
This was the reason I switched to other languages that are more suitable to satisfy my needs.
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Re: Classes in PureBasic
For this reason, I have moved on to other languages,
What if not a secret?
-
- Addict
- Posts: 1518
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: Classes in PureBasic
Fred creates a PB, just for yourself?Shield wrote:Because Fred doesn't want to.
PB and so is not very popular. Need to listen to the views community, and implement modern features of a programming language.
Re: Classes in PureBasic
So we have to listen to you ? Not everybody wants OOP, and PB won't have a OOP built-in, it's a design choice and I have made it clear a lot of time on this forum. If you don't like it, do as Shield did, find a tool which fits your needs better.
Re: Classes in PureBasic
Fred, would you consider another language spinoff like PooBasic? 

The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: Classes in PureBasic
PooBasic, really ??????? 

Re: Classes in PureBasic
I was half kidding.
The other half was serious. I want to import C++ libs without extern C wrappers.

The other half was serious. I want to import C++ libs without extern C wrappers.

The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: Classes in PureBasic
It should may be possible trough special interfaces, so it doesn't requiers built-in OOP.
Re: Classes in PureBasic
Ah, that would be awesome.
The list of C++ libs are growing and not always support extern C.
Forgive my ignorance of features that are OOP limited.
Is the lack of operator and procedure overloading OOP related also?
It is a nuisance to write multiple copies of Procedures just to handle different datatypes.

The list of C++ libs are growing and not always support extern C.
Forgive my ignorance of features that are OOP limited.
Is the lack of operator and procedure overloading OOP related also?
It is a nuisance to write multiple copies of Procedures just to handle different datatypes.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum