Allow use of [] for lists and arrays

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Captn. Jinguji
User
User
Posts: 94
Joined: Sun Oct 24, 2004 9:25 am

Re: Allow use of [] for lists and arrays

Post by Captn. Jinguji »

milan1612 wrote:
gnozal wrote:
AND51 wrote:I don't like to use AltGr everytime I want to type the name of an array or list, Shift is better.
+1
Same on french keyboards, probably on most non english keyboards ?
That's why I bought a US layout keyboard, it's less hassle to enter
the German Umlauts by typing in a combination of keys once
in a while than to ruin your wrist over the time with AltGr + ... :lol:

+1 to the request btw...
Ye olde STRG+ALT 9 key trick still worketh ;)
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Re: Allow use of [] for lists and arrays

Post by AND51 »

milan1612 wrote:
gnozal wrote:
AND51 wrote:I don't like to use AltGr everytime I want to type the name of an array or list, Shift is better.
+1
Same on french keyboards, probably on most non english keyboards ?
That's why I bought a US layout keyboard
You cannot expect people to change their keyboard layout or buy a new keyboard only to cope with [ and ]. But I just assume, this idea was kinda joke... :P
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Thalius
Enthusiast
Enthusiast
Posts: 711
Joined: Thu Jul 17, 2003 4:15 pm
Contact:

Post by Thalius »

hmmm.... :?

Code: Select all

Structure bar
  a.l
  foo.l[10]
EndStructure


NewList foo.bar[]

AddElement(foo())
foo[]\foo[2] = 5

Debug foo[]\foo[1]
Debug foo[]\foo[2]
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! ;)"
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

-1

Just MHO

I use [] for pointer arrays stepping though memory blocks. I see the square brackets and know I'm working with raw memory and not PB structured arrays.

Going back to "What problem are we trying so solve" it looks like the issue is when there is nesting, arrays in functions etc then the level of curved brackets becomes ambiguous. An alternative solution would be to have the IDE colour code curved bracked at matching depth

MyProc(Left(MyArray(1),1))

Which could be customised as per other colouring preferences in the IDE.

my 2 yen
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

nested colouring would eat up a lot of editor's performance, I would suspect.
I'm happy with getting both brackets highlighted in blue when the cursor is on one of them,
resp. get the one highlighted in red when there is no match.

btw... is there a function to jump to the corresponting command,
e.g. jumping from the EndIf to the If by just one keypress?
oh... and have a nice day.
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

Maybe these things could be toggled then.

I'm just thinking out loud though
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

> I'm just thinking out loud though

you're not in public I hope?
else they may call you "crazy-gaijin-who-talks-to-his-computer-in-the-morning"...
oh... and have a nice day.
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

:)

I'm used to being called a crazy gaijin for whatever reason, pretty soon 1/3rd of my life will have been living here. better the bad mouthing come to me than go to my family if I was back in AU :P
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

Gajin... you're in Asia? China or Japan or something? Ah, I see, Japan...

Good stuff, always had a soft spot for Asia, but never found a good job there, except for a one year stay in China.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Having () and [] be interchangeable would in my opinion decrease code readability. I don't think this is really necessary.
Post Reply