improve Procedures

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Darie
New User
New User
Posts: 2
Joined: Thu Dec 14, 2006 5:23 pm

improve Procedures

Post by Darie »

At first, i adore the new PureBasic Version !!! Pure Basic is getting better...
But I'd like to suggest something:

It should be possible to define procedures within procedures (like you can do with turbo pascal or delphi) and it should be possible to pass completed structures, arrays or LinkedLists as parameters and also return them back completely with the ProcedureReturn-Command.

I think, this would improve much structured programming, because you can write "self-contained" procedures and use them like methods for structures etc.
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Doesn't sound very Pure to me and i think it somehow contardicts to the fact that pureBasic is very C like. In my opinion the only thing we can do very easily whcih would improve Code structure a lot would be namespaces as in C++
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

> Doesn't sound very Pure to me and i think it somehow contardicts to the fact that pureBasic is very C like.
Which in fact lets you return a structure...
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Re: improve Procedures

Post by Kale »

Darie wrote:At first, i adore the new PureBasic Version !!! Pure Basic is getting better...
But I'd like to suggest something:

It should be possible to define procedures within procedures (like you can do with turbo pascal or delphi) and it should be possible to pass completed structures, arrays or LinkedLists as parameters and also return them back completely with the ProcedureReturn-Command.

I think, this would improve much structured programming, because you can write "self-contained" procedures and use them like methods for structures etc.
The procedure within a procedure is not possible with PB but everything else is. Arrays and Linked lists are passed by reference. meaning that when manipulated within a procedure you are really manipulating the original that was passed as a parameter. Structured vars can be returned as a pointer, which can be accessed using a structured pointer variable.

Search the forum there are loads of examples:
http://www.purebasic.fr/english/viewtopic.php?t=14737
http://www.purebasic.fr/english/viewtopic.php?t=21644
http://www.purebasic.fr/english/viewtopic.php?t=13363
--Kale

Image
Darie
New User
New User
Posts: 2
Joined: Thu Dec 14, 2006 5:23 pm

Post by Darie »

Isn't Fred trying to include OOP-Coding to pureBasic?

Have a look here -->
http://drac.site.chez-alice.fr/Tutorial ... en.htm#POO

It's possible to code OOP in PureBasic but it's a little bit confusing, don't you agree?

I think, making it possible to return everykind of datatypes in a procedure would make it much easier to code OOPlike programs.
You would be able to create LinkedLists or Arrays containing the Object-Datas (e.g. with structures) and use the procedures as methods.
Post Reply