Cast types

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

mmm why would it be confusing? it's rather simple: use the last type def the compiler encountered

if one adds the type def to the pointer, from that moment on the def changes

i agree that if a change would be temporary the use of parenthesis would be better

*a.(lasjdf)\asdf = asdfasdf

but it will raise quite a few questions with the crowd... i'd suggest to move the last parenthesis:

*a.(asdf\asdf) = asdfasd

or perhaps use a different type of bracket, dunno

*a.[asdf\asdf] = asdfasd

square brackets have a slight preference for me, as in (most) basics normal parenthesis are 'enclosures' of functions or expressions, but not an inherent part of the syntax, they might cause some confusion with dimmed stuff...

dim *a.b(100)

*a(x) = 5
*a.(x)\b = 5

while square brackets in a different place are slightly easier to read:

*a.[x\b] = 5
( 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... )
PolyVector
Enthusiast
Enthusiast
Posts: 499
Joined: Wed Sep 17, 2003 9:17 pm
Location: Southern California
Contact:

Post by PolyVector »

I agree with Fred on the more c-like implimentation for temperary use...

If there needs to be a change-as-you-go method, then I say keep the current syntax, and allow the type to be changed with another standard definition:

Code: Select all

*Var.StructABC\a=1
*Var\b=2
*Var\c=3

*Var2.StructXYZ\x=4
*Var2.(StructABC)\b=5
*Var2\z=6
Last edited by PolyVector on Mon Aug 30, 2004 10:01 am, edited 2 times in total.
soerenkj
User
User
Posts: 95
Joined: Mon Jun 14, 2004 10:19 pm

Post by soerenkj »

is this going to be implemented..?
I really need it now!
Post Reply