Declare should be need only the type (no variable name)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
IceSoft
Addict
Addict
Posts: 1683
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Declare should be need only the type (no variable name)

Post by IceSoft »

Currently:

Code: Select all

Declare ScanDir.l(Dir.s, C.l, a.b, r.w) 
Better:

Code: Select all

Declare ScanDir.l(.s, .l, .a, .w) 
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: Declare should be need only the type (no variable name)

Post by traumatic »

IceSoft wrote:

Code: Select all

Declare ScanDir.l(.s, .l, .a, .w) 
So what's better with that?
Good programmers don't comment their code. It was hard to write, should be hard to read.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Declare should be need only the type (no variable name)

Post by PB »

Less typing when the params have longer names.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Declare should be need only the type (no variable name)

Post by ts-soft »

PB wrote:Less typing when the params have longer names.
Is not required to use the long names for declare.

Code: Select all

Declare ScanDir.l(a.s, b.l, c.b, d.w) 
Only the type and count must be correct
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.
Image
User avatar
IceSoft
Addict
Addict
Posts: 1683
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: Declare should be need only the type (no variable name)

Post by IceSoft »

ts-soft wrote:Is not required to use the long names for declare.

Code: Select all

Declare ScanDir.l(a.s, b.l, c.b, d.w) 
Only the type and count must be correct
Yes I know...that's the reason why I write this request.
The name of the variable is not checked...so it should be removed
Last edited by IceSoft on Wed Oct 08, 2008 11:23 am, edited 1 time in total.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Declare should be need only the type (no variable name)

Post by PB »

> Is not required to use the long names for declare

I never knew that (I hardly ever use Declare, and when I do, I just copied
the procedure definition to save typing it all). I assumed everyone did it like
that. :lol:
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

I wrote a tool that parses my source code and copies all of the declares to the clipboard. One-click-- done. I consider your request to be an oversimplification to an adequate design.
User avatar
IceSoft
Addict
Addict
Posts: 1683
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

Mistrel wrote:I wrote a tool that parses my source code and copies all of the declares to the clipboard. One-click-- done. I consider your request to be an oversimplification to an adequate design.
As easier as better.
The best ideas been often the easiest solution.
Look on lot of patents and you understand me.

As long you need a tool to remove/adapt something...as long it is not perfect.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: Declare should be need only the type (no variable name)

Post by traumatic »

PB wrote:Less typing when the params have longer names.
Shouldn't params somehow be self-explanatory?
I'd really like to understand but I don't get the idea.
Well, on the other hand I don't have to ;)
Good programmers don't comment their code. It was hard to write, should be hard to read.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

IceSoft wrote:As long you need a tool to remove/adapt something...as long it is not perfect.
“Perfection is reached not when there’s nothing left to add, but when there’s nothing left to remove.” (Antoine de St. Exupery)

PB wrote:(I hardly ever use Declare, and when I do, I just copied
the procedure definition to save typing it all)
=> no tool needed at all

IceSoft wrote:Currently:

Code: Select all

Declare ScanDir.l(Dir.s, C.l, a.b, r.w) 
Better:

Code: Select all

Declare ScanDir.l(.s, .l, .a, .w) 
... why not? wouldn't apply to me at all -> quote="PB"
oh... and have a nice day.
EdzUp[SD]
Enthusiast
Enthusiast
Posts: 104
Joined: Thu Jun 26, 2008 10:53 pm
Location: Banstead, UK

Post by EdzUp[SD] »

Declare ScanDir.l(Dir.s, C.l, a.b, r.w)
simple copy paste and a little adjustment would give

Procedure.l ScanDir(Dir.s, C.l, a.b, r.w)

surely just copy and paste then small adjustment is simple enough
User avatar
IceSoft
Addict
Addict
Posts: 1683
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

EdzUp[SD] wrote:surely just copy and paste then small adjustment is simple enough
Of course...You are right. That's not what I mean.

The different is: I can declare like this:

Code: Select all

 Declare BlaBla.l(a.l, b.b, c.c)
and use:

Code: Select all

Procedure.l BlaBla(ThisIsMYfirst.l, aShorterOne.b, s.c)
If there is no check...why I should write it?
Ok right... I write it because my varaibles are selfdescriping...
For that I can also use comments ;-)

And be a realist: Do you really use such long names for variables?
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

another (and in my opinion more important) point just occurring to me now as I see the Declaration above:
Declare ScanDir.l(Dir.s, C.l, a.b, r.w)
Procedure.l ScanDir(Dir.s, C.l, a.b, r.w)
... I would like to see it being changed either to
Procedure ScanDir.l
or to
Declare.l ScanDir
to have a more consistant syntax.

the latter would produce less incompatibilities, I would say.
oh... and have a nice day.
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

IceSoft wrote:And be a realist: Do you really use such long names for variables?
Can't talk for others but I certainly do. That's what variable names are for.

...and what about the "less typing" argument when you're OK with writing
more comments that way? ;)
Good programmers don't comment their code. It was hard to write, should be hard to read.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Very agree with IceSoft:
+1
And the same for Prototype. (so another +1 for me :) )
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Post Reply