[Implemented] Very long statements
I politely disagree, adding [ ] or the alike would break readablity of code, right now it's readable under most conditions, but adding things lile [ ] would break readable code, [IMHO].
Strings for example when the preprocessor see " Will contune to think that is it a string until it reaches another > " which will notify it of the end of the quote or string, any 0x0A or 0x0D found in the string are ignored.
ricardo: not quite sure what you mean by IF's ELSEIF's etc, could you elaborate ?
Strings for example when the preprocessor see " Will contune to think that is it a string until it reaches another > " which will notify it of the end of the quote or string, any 0x0A or 0x0D found in the string are ignored.
ricardo: not quite sure what you mean by IF's ELSEIF's etc, could you elaborate ?
Inner,
I shifted my stance here to use the existing brackets, rather than adding new ones.
So in your example
The CRs are ignored because they are inside the brackets (). I think these brackets are enough, there would be no need to add new ones.
So the rule is based on the existing brackets and not the comma, so that lines could also be broken up with the or operators, etc.
I shifted my stance here to use the existing brackets, rather than adding new ones.
So in your example
Code: Select all
Foo(apple,
fruity,
basket,
food,
fight)
So the rule is based on the existing brackets and not the comma, so that lines could also be broken up with the or operators, etc.
Don't much care how we do it - it'd be a great thing to have though!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
My two cents worth.
Actujally, 3 cents:
(1) I like " _" in place of just "_". After all, underscore could be a valid
last letter of a variable name. The extra space or tab character prevents it from being interpreted as such. This method is used with several BASICs, and has the advantage that you mask out the quoted text and the comments, then search for the occurance of " _", and break the line at that point and join the next line to it. If that also ends in a " _", you
just repeat the process, as many times as necessary. It is a very simple parsing mechanism. Second, a number of programmers use this method
to add comments in innovative ways, since nothing after the " _" is handled by the compiler. So you could have the following:
:this is a comment _
and so is this _
and so is this.
You can even use it to align comments like this:
In other words, you can get very creative with the use of the inderscore as a line join indicator.
(2) I tried to compile the purebasic.ide.pb program, but ran into some issues. I wanted to figure out where certain added capabilities could go. My idea is to do three things:
(a) extend the search to search each help in order -- PB, FASM, ASM, Win32, and so on. If it cannot find a match, it looks in other programs for declares, globals, and procedures that might match. Everything from the
PureBASIC root directory would be fair game for a search. Since a search could take a good while, I would attempt a crossreference index and also allow the search to be broken off if it runs too long.
(b) Use this technique to determine if a given file is a standalone executable, depends on terms, structures and constants found in any include files, and determine if it itself is subject to any include statements in any other programs. Again, crossreferencing would speed this process over time.
(c) Add a search for path for any include files, in case the PureBASIC tree on a target system differes from the source system. When there is more than one source, allow the user to designate, so that by a process of trial and error, the correct sequence can be established.
(d) Add a reformatting tool, so that source code can be optimized in
terms of readability. This would include such things as indent size, whether Case should indent further than Select and EndSelect, and whether code should have the main code first with Declares, followed by Procedures, or Procedures first. just for consistency. Line joins could be
inserted automatically to allow lines to wrap to fit within the IDE view window. It could also comment Next, Wend, and Until statements to make it easier to match to the original For, While, and Repeat stateents.
Technically, they might also be able to automatically tag comments to ElseIf, Else, and EndIf statements as well. This seems like overkill, but the ability could make it easier for someone to track up a long trail of statements to find the point of origin, or do down it to find the end.
But these are just to-do or would-be-nice ideas. The big one follows:
(3) HAVE THE COMPILER IGNORE EVERY DUPLICATE OF A DECLARE, STRUCTURE, OR CONSTANT. My point is that when you consolidate all your structures and constants together, you may have several secondary (include) as well as primary files pointed at that one reference. As long
as everything matches up in value or form, this should be tollerated and
ignored. When they don't match, the compiler should report that there is a conflict with a prior definition (different size, different fields, different
values for constants). XIncludeFile() ignores that a file was processed previously, but you still get the error on Structures that are redefined.
(1) I like " _" in place of just "_". After all, underscore could be a valid
last letter of a variable name. The extra space or tab character prevents it from being interpreted as such. This method is used with several BASICs, and has the advantage that you mask out the quoted text and the comments, then search for the occurance of " _", and break the line at that point and join the next line to it. If that also ends in a " _", you
just repeat the process, as many times as necessary. It is a very simple parsing mechanism. Second, a number of programmers use this method
to add comments in innovative ways, since nothing after the " _" is handled by the compiler. So you could have the following:
:this is a comment _
and so is this _
and so is this.
You can even use it to align comments like this:
Code: Select all
_ this is a comment
_ and so is this
_ and so is this.
or you could use it this way: _ this is also a comment & line join
____________________ This starts a comment box ______________
_ this is a comment _
_ and so is this _
_ and so is this _
____________________ This ends a comment box _______________
(2) I tried to compile the purebasic.ide.pb program, but ran into some issues. I wanted to figure out where certain added capabilities could go. My idea is to do three things:
(a) extend the search to search each help in order -- PB, FASM, ASM, Win32, and so on. If it cannot find a match, it looks in other programs for declares, globals, and procedures that might match. Everything from the
PureBASIC root directory would be fair game for a search. Since a search could take a good while, I would attempt a crossreference index and also allow the search to be broken off if it runs too long.
(b) Use this technique to determine if a given file is a standalone executable, depends on terms, structures and constants found in any include files, and determine if it itself is subject to any include statements in any other programs. Again, crossreferencing would speed this process over time.
(c) Add a search for path for any include files, in case the PureBASIC tree on a target system differes from the source system. When there is more than one source, allow the user to designate, so that by a process of trial and error, the correct sequence can be established.
(d) Add a reformatting tool, so that source code can be optimized in
terms of readability. This would include such things as indent size, whether Case should indent further than Select and EndSelect, and whether code should have the main code first with Declares, followed by Procedures, or Procedures first. just for consistency. Line joins could be
inserted automatically to allow lines to wrap to fit within the IDE view window. It could also comment Next, Wend, and Until statements to make it easier to match to the original For, While, and Repeat stateents.
Technically, they might also be able to automatically tag comments to ElseIf, Else, and EndIf statements as well. This seems like overkill, but the ability could make it easier for someone to track up a long trail of statements to find the point of origin, or do down it to find the end.
But these are just to-do or would-be-nice ideas. The big one follows:
(3) HAVE THE COMPILER IGNORE EVERY DUPLICATE OF A DECLARE, STRUCTURE, OR CONSTANT. My point is that when you consolidate all your structures and constants together, you may have several secondary (include) as well as primary files pointed at that one reference. As long
as everything matches up in value or form, this should be tollerated and
ignored. When they don't match, the compiler should report that there is a conflict with a prior definition (different size, different fields, different
values for constants). XIncludeFile() ignores that a file was processed previously, but you still get the error on Structures that are redefined.
has-been wanna-be (You may not agree with what I say, but it will make you think).
-
- Enthusiast
- Posts: 142
- Joined: Mon Sep 17, 2007 10:28 am
- Location: P.O.P
- Contact:
- Joakim Christiansen
- Addict
- Posts: 2452
- Joined: Wed Dec 22, 2004 4:12 pm
- Location: Norway
- Contact:
Finally some intelligenceGedB wrote:Inner,
I shifted my stance here to use the existing brackets, rather than adding new ones.
So in your example
The CRs are ignored because they are inside the brackets (). I think these brackets are enough, there would be no need to add new ones.Code: Select all
Foo(apple, fruity, basket, food, fight)
So the rule is based on the existing brackets and not the comma, so that lines could also be broken up with the or operators, etc.

I like logic, hence I dislike humans but love computers.
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
I could work t either way as both those characters are on my keyboard without having to do some weird [ALT]+ combination.
I refuse to use a windows keyboard. I love my ALPS OmniKey/PLUS and my other IBM APLS models...
OK so no "windows" key. But you know, don't miss it that much!
Ending with a ' or even an ^, ~, or |\ / I am cool... I have several LONG lines that I would like to truncate so I can more easily read my code ON SCREEN!
PB 4b4 is gonna rock!
I refuse to use a windows keyboard. I love my ALPS OmniKey/PLUS and my other IBM APLS models...
OK so no "windows" key. But you know, don't miss it that much!
Ending with a ' or even an ^, ~, or |\ / I am cool... I have several LONG lines that I would like to truncate so I can more easily read my code ON SCREEN!

PB 4b4 is gonna rock!
-
- Enthusiast
- Posts: 142
- Joined: Mon Sep 17, 2007 10:28 am
- Location: P.O.P
- Contact:
I fully support the idea of having the possebility of breaking long lines and I don't care how we do it, as long as we can do it.
So use _ or | or ~ or whatever. But please make it happen.
Horizontal scrolling is annoying and sometimes not possible!
Therefore here's another request for the IDE: a vertical line that can be adjusted to show up at char 79 or 80,... some of you might know from other Editors (especially on Linux).
So use _ or | or ~ or whatever. But please make it happen.
Horizontal scrolling is annoying and sometimes not possible!
Therefore here's another request for the IDE: a vertical line that can be adjusted to show up at char 79 or 80,... some of you might know from other Editors (especially on Linux).
cheers,
bembulak
bembulak
SSH / Telnet / Terminal Sessions. Mostly affects Linux users, but I also struggle with it on Windows now and then, working on the company's Server from outside via GSM-Connection (it's too slow to have RDP running).
80 characters, 24 Lines.

http://en.wikipedia.org/wiki/Vt100
http://en.wikipedia.org/wiki/Terminal_emulator
80 characters, 24 Lines.

http://en.wikipedia.org/wiki/Vt100
http://en.wikipedia.org/wiki/Terminal_emulator
cheers,
bembulak
bembulak
Re: Very long statements
I'll just repost here to add my vote to have this done.
My code in other languages is overly documented (is this really possible) and very clean. I'd like to add pure basic to my arsenal. Below is an example of ugly vs. clean (artsy code)
My code in other languages is overly documented (is this really possible) and very clean. I'd like to add pure basic to my arsenal. Below is an example of ugly vs. clean (artsy code)

Code: Select all
;------------------------------------------------------------
; create a main window
;------------------------------------------------------------
mainWin = OpenWindow(#PB_Any, 0, 0, 270, 140, "ListViewGadget", #PB_Window_SystemMenu | #PB_Window_SizeGadget |#PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered)
vs.
;------------------------------------------------------------
; create a main window
;------------------------------------------------------------
mainWin = OpenWindow(#PB_Any, ;; create a window and assign id to mainWin
0, 0, 270, 140, ;; window size
"ListViewGadget", ;; name of window appears in title bar
#PB_Window_SystemMenu | ;; include a system menu
#PB_Window_SizeGadget | ;; allow resizing
#PB_Window_MinimizeGadget | ;; allow minimize button
#PB_Window_MaximizeGadget | ;; allow maximize button
#PB_Window_ScreenCentered) ;; center on screen
Re: Very long statements
Touchy subject, and a very old one at that 
Many people have requested such a feature, but it hasn't surfaced yet.
The only way currently possible is a preprocessor, such as CodeCaddy, to add multiline capabilities to PureBasic, such as this:
It's not perfect yet as the compiler doesn't let me easily preprocess include files. I hope that's an upcoming feature, in which case I do not need PureBasic itself to provide me multiline functionality.

Many people have requested such a feature, but it hasn't surfaced yet.
The only way currently possible is a preprocessor, such as CodeCaddy, to add multiline capabilities to PureBasic, such as this:
Code: Select all
a.s = " 123
_ 456
_ 789"
Debug a.s
b.l = 1 + _
2 + _
3 + _
4
Debug b
( 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... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: Very long statements
Multiline would be nice, unfortunately _ can't be used, as it's a legal variable name.