Deprecate words 'Dim', 'NewList', 'NewMap'

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Derren
Enthusiast
Enthusiast
Posts: 316
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Deprecate words 'Dim', 'NewList', 'NewMap'

Post by Derren »

The only thing I'd want to change is that you have to give a dimension to an Array in procedure. Since the array is provided from an external source it doesn't make sense to pre-dim the Array.

Not exactly related to this topic, though.
User avatar
heartbone
Addict
Addict
Posts: 1058
Joined: Fri Apr 12, 2013 1:55 pm
Location: just outside of Ferguson

Re: Deprecate words 'Dim', 'NewList', 'NewMap'

Post by heartbone »

gavindi wrote:I like your suggestion. It would bring a little more consistency to the syntax. +1
Not at all. Without an extensive redo of the documentation it would be much more confusing to beginners.

The documentation already has:
Chapter 93
Array

and

93.1
ArraySize
Syntax
Result = ArraySize ( Array () [ , Dimension ])


If you were to rename it, then
DimensionArray() and RedimensionArray()
would make far more sense than the previous suggestion.

Leave it alone or change EllapsedMilliseconds() to RetrieveCurrentTimerValue()
Because in my code the elapsed milliseconds actually has to be calculated from the returned value of EllapsedMilliseconds().

If it ain't broke...
Derren wrote:The only thing I'd want to change is that you have to give a dimension to an Array in procedure. Since the array is provided from an external source it doesn't make sense to pre-dim the Array.
Good idea.
Keep it BASIC.
User avatar
Derren
Enthusiast
Enthusiast
Posts: 316
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Deprecate words 'Dim', 'NewList', 'NewMap'

Post by Derren »

Apropos documentation...
When I hit F1 on "Array" I am directed to the Array help page where I have to find Array manually. This is true for a few keywords that are bunched up together on a single page. I don't know if chm files support anchors, else single subpages or at least a clickable link index on top of each page would be a good idea...
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: Deprecate words 'Dim', 'NewList', 'NewMap'

Post by Psychophanta »

The issue is that there are some prefixes, like 'Open' like OpenWindow(), 'Add', 'New', 'Create' like CreateSprite(), and perhaps this should be revised for more syntax consistence.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Opcode
Enthusiast
Enthusiast
Posts: 138
Joined: Thu Jul 18, 2013 4:58 am

Re: Deprecate words 'Dim', 'NewList', 'NewMap'

Post by Opcode »

Everything's fine the way it is, if it's not broken don't fix it.

Tho if any change at all.
  • NewList => CreateList
  • NewMap => CreateMap
Dim and ReDim were probably borrowed from Visual Basic. I personally don't see any reason for changing them.
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: Deprecate words 'Dim', 'NewList', 'NewMap'

Post by Seymour Clufley »

I agree with the OP.

It adds nothing, in terms of clarity or function, to have separate words for writing an array inside and outside a structure. With that in mind, why not just make things as simple as possible and use one word?
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
User avatar
Derren
Enthusiast
Enthusiast
Posts: 316
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Deprecate words 'Dim', 'NewList', 'NewMap'

Post by Derren »

Seymour Clufley wrote:I agree with the OP.

It adds nothing, in terms of clarity or function, to have separate words for writing an array inside and outside a structure. With that in mind, why not just make things as simple as possible and use one word?
Why not have a more powerful pre-compiler?

This is possibly valid code in theory:

Code: Select all

Define foo.i(1)
foo(0)=20
foo(1)=30

Procedure bla(myArray())
  ProcedureReturn myArray(0) + myArray(1)
EndProcedure 

Debug bla(foo()) ;50
All these little tweaks don't seem to make sense to me. Either make one big change, or don't change anything at all.
Post Reply