Change \ with .

Got an idea for enhancing PureBasic? New command(s) you'd like to see?

SHOULD THE \ GO AWAY AND THE . RULE ?

GIVE ME THE DOT, PB IS GROWN UP NOW!
18
17%
GIVE ME THE DOT, PB IS GROWN UP NOW!
18
17%
REALLY DON'T CARE...
14
13%
REALLY DON'T CARE...
14
13%
LIKE IT AS IT IS - WITH THE BACKSLASH...
22
20%
LIKE IT AS IT IS - WITH THE BACKSLASH...
22
20%
 
Total votes: 108

User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Change \ with .

Post by fsw »

I would like to see this:

ColoredPoint.MyColoredPoint.Color = RGB(255, 0, 0)

instead of this:

ColoredPoint.MyColoredPoint\Color = RGB(255, 0, 0)


Would be nice to get the DOT like other programming languages.

What do you think :?:
aaron
Enthusiast
Enthusiast
Posts: 267
Joined: Mon Apr 19, 2004 3:04 am
Location: Canada
Contact:

Post by aaron »

Count me in for a big "don't care". I just finished getting used to the slash method rather than dots, but I can swing either way. If this was changed though, PureBasic would have to support both methods... imagine the sheer amount of source code that would break if the slash was dropped in favour of the dot....
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post by Moonshine »

I agree, the dot would make life a bit easier when porting code from other languages such as VB and C++.
Mark my words, when you least expect it, your uppance will come...
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Re: Change \ with .

Post by Doobrey »

I know this is OT, but it`s still to do with structures.
There was a command in the old Amiga Blitz Basic I found useful,( but I can`t remember what is was called :roll: ) and would like to see in PB.
It saved sh*tloads of typing when you wanted to change the contents of a structure that was deep inside another structure.

Use Mystructure\substructure\anotherstructure\yetanotherstructure

yetanotherstructure\var1=50
yetanotherstructure\var2="wibble"
etc.etc.

I know you could use..
*yetanotherstructure.SomeStructure =@Mystructure\substructure\anotherstructure\yetanotherstructure
*yetanotherstructure\var1=50 etc.
but it just doesn`t seem as neat..
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Re: Change \ with .

Post by GPI »

fsw wrote:ColoredPoint.MyColoredPoint.Color = RGB(255, 0, 0)
-
ColoredPoint.MyColoredPoint\Color = RGB(255, 0, 0)
No, don't change this. All codes must be change!
btw:
At the moment:

Code: Select all

ColoredPoint.MyColoredPoint
ColoredPoint\Color=RGB(255,0,0)
and you will:

Code: Select all

ColoredPoint.MyColoredPoint
ColoredPoint.Color=RGB(255,0,0)
Do you see the comflict? Your your has two possible meanings and make it difficult to understand for beginners.
plouf
Enthusiast
Enthusiast
Posts: 281
Joined: Fri Apr 25, 2003 6:35 pm
Location: Athens,Greece

Post by plouf »

definitelly not
not a serious reason to change core stuff
code should change confusion blabla
anyway when you port stuff from C slash is the least you must convert
to a absolute diffirent languange
Christos
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Re: Change \ with .

Post by tinman »

Doobrey wrote:I know this is OT, but it`s still to do with structures.
There was a command in the old Amiga Blitz Basic I found useful,( but I can`t remember what is was called :roll: ) and would like to see in PB.
UsePath :)

Bernd Roesch later added a UseLastPath command, which is pretty useful if you want to fiddle with the path inside a set of included procedures but not have to bug the user with setting the path again after calling your functions.


Edit:
Being facetious, why not ask for the -> notation also for structures that are accessed by pointer? It makes about as much sense.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Re: Change \ with .

Post by Doobrey »

@Father Jack,
What`s facetious about asking for -> ?
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Re: Change \ with .

Post by tinman »

Doobrey wrote:@Father Jack,
What`s facetious about asking for -> ?
I was poking fun at the feature request :)

It might as well also get added if we want PB to become a language that C code can easily be ported to.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
VPureBasic
User
User
Posts: 59
Joined: Fri Apr 25, 2003 6:09 pm
Location: Quebec - Canada

Post by VPureBasic »

Hi All,

I agree with Tinman... PB should have its own command: Usepath StructureName. With this add on, some people will find that more easy to code. Here an example for people who did not have the chance to code with Amiga Blitz!

Code: Select all

Global Struct.RECT

Usepath Struct
    OpenWindow( 0,\left , \top, \right, \bottom, #PB_Window_SystemMenu,"" )

etc...
IMO If Fred can add this command, I think that people will want to keep the slash instead of the dot.

Roger
Everything is possible with PureBASIC... All you're missing is imagination!
oldefoxx
Enthusiast
Enthusiast
Posts: 532
Joined: Fri Jul 25, 2003 11:24 pm

Post by oldefoxx »

I personally prefer the DOT notation rather than the BACKSLASH, but if
you work with anything long enough, you get use to it. A preprocessor/ Editor could be made that could make the changes for you, so this is not
really something that PB has to do to make you happy.

The thing I really don't like the backslash being used for subscripts is that
I like the integer divide feature found in some languages that the backslash represented. It means not having to do a Int(a/b) to get the
same result of a\b, but of course a smart compiler could make this equally
effective, so then it would only be a matter of expression in the source file.

But when it comes to arguing that such changes would make porting source code from C to PB easier, I think you are ignoring the fact that
there are many obsticles to a direct port. Certain precepts, such as file
I/O and memory management, become impactive when dealing with
more than trivial programming efforts. A little notation change is hardly
of any importance when it comes to that.

The \ notation is not unique to PB - several other basics have adopted as well. So in that regard, PB is consistent with usage elsewhere, but not all
dialogs of Basic are the same. To expect PB to conform to our precepts
and prior exposure is perhaps unrealistic. But the big thing for any language is consistency within its own set of rules, and a notation that
allows you the means of performing whatever operation is consistent with your needs and expectations. The acid test for a compiler use to be whether you could write a compiler using the existing compiler. I think
PB pretty much meets that requirement.
has-been wanna-be (You may not agree with what I say, but it will make you think).
syntax error
User
User
Posts: 93
Joined: Tue Jan 13, 2004 5:11 am
Location: Midlands , UK

Post by syntax error »

I like the dot method as well. Seems logical to me.
It *can* get confusing using the \ especially when is comes to divding ..

Code: Select all

Structure test
  a.l
  b.f
  c.b
  d.w
EndStructure

t.test
t\a=1234
t\c=127
t\d=4096

t\b=t\d/t\c
As GPL points out, currently declaring variables uses the dot notation.
This would cause conficts/confusion:

Code: Select all

Structure test
  a.l
  b.f
  c.b
  d.w
EndStructure

t.test
t.a=1234
t.b=1.414  ; *** are we turning t into a BYTE here?
t.c=127
t.d=4096
So, to use DOT would require a new method to declare the vars:

Code: Select all

t:test      ; test struct
c:f         ; float
x:w        ; word
Like opening a can of worms hey!
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

syntax, you got your point, although i'd assume what comes first goes first, so if .b is already taken, it's not going to refer to the field but to the var type

anyway, i wouldn't care much, i'd slightly prefer dot notation, but i agree it would break up code, so i'll just stick to the current form... there's other much more important stuff to be fixed :-)
( 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... )
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Syntax has right. Even though its gonna work in code, it would look weird.
also all the code changing that would be. As blueznl said, theres much more important things to do.
oldefoxx
Enthusiast
Enthusiast
Posts: 532
Joined: Fri Jul 25, 2003 11:24 pm

Post by oldefoxx »

Agreed. PB's approach to self-declaring a variable type with a DOT
notation is somewhat unique. It would also have to be changed to
another form, and unless someone knows what real advantage there is
in doing all this, which would change the language drastically, it seems pointless to press the issue.

The best way to enhance PB is to work on additions or modifications that
remain consistent with the existing syntax, so that you minimize the lost
of productivity as a result of having to modifiy existing code, and permit snippits of code to be reused pretty much as they are currently written.
has-been wanna-be (You may not agree with what I say, but it will make you think).
Locked