Page 1 of 4
Change \ with .
Posted: Sat May 29, 2004 12:33 am
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

Posted: Sat May 29, 2004 12:45 am
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....
Posted: Sat May 29, 2004 1:00 am
by Moonshine
I agree, the dot would make life a bit easier when porting code from other languages such as VB and C++.
Re: Change \ with .
Posted: Sat May 29, 2004 1:14 am
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..
Re: Change \ with .
Posted: Sat May 29, 2004 6:57 am
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.
Posted: Sat May 29, 2004 7:52 pm
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
Re: Change \ with .
Posted: Sat May 29, 2004 8:24 pm
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.
Re: Change \ with .
Posted: Sun May 30, 2004 12:49 am
by Doobrey
@Father Jack,
What`s facetious about asking for -> ?
Re: Change \ with .
Posted: Sun May 30, 2004 10:11 am
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.
Posted: Sun May 30, 2004 2:05 pm
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
Posted: Mon May 31, 2004 2:02 am
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.
Posted: Mon May 31, 2004 9:53 am
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!
Posted: Mon May 31, 2004 10:13 am
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

Posted: Mon May 31, 2004 10:18 am
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.
Posted: Mon May 31, 2004 5:49 pm
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.