Page 1 of 1

Allow splitting function lines before the paremeter list

Posted: Mon Sep 19, 2016 12:48 am
by Mistrel
I'm not sure when we got this feature but I just now realized that we can split lines up like this:

Code: Select all

Debug 1 +
  2 + 3
Then I thought I would finally get to split up my function declarations and definitions like so:

Code: Select all

declare
  func(
    something_a,
    something_b,
    something_c
)

Procedure
  func(
    something_a,
    something_b,
    something_c
)
  
EndProcedure
But I can't do this without putting at least one parameter on the first line. Which makes this ugly.

I know that the purpose was probably to split the line somewhere after a comma but I would prefer the option to format my declarations as described.

Re: Allow splitting function lines before the paremeter list

Posted: Sat Oct 15, 2016 1:40 pm
by Mistrel
Line splitting as it is currently is great at helping to keep lines under 80 characters but I would still like to see greater flexibility. In its current form it lends itself to being ugly and difficult to read.

For example, I have to currently do this to keep my function under 80 characters:

Code: Select all

Procedure.POINTER BitSet_Create(_IN Length.l, 
  _IN_OPT BlockSize.BITSET_BLOCKSIZE=#BitSet_BlockSize_Byte,
  _IN_OPT ByteOrder.BITSET_BYTEORDER=#BitSet_ByteOrder_LittleEndian)
Whereas I want to do this which is much more readable:

Code: Select all

Procedure.POINTER 
  BitSet_Create(
    _IN     Length.l, 
    _IN_OPT BlockSize.BITSET_BLOCKSIZE=#BitSet_BlockSize_Byte,
    _IN_OPT ByteOrder.BITSET_BYTEORDER=#BitSet_ByteOrder_LittleEndian
)
The same goes for operators. It's frustrating to have to scan over the entire line to see if there is a trailing operator. I would much rather scan vertically along the first character of my indent blocks which would all be lined up and easy to see.

Re: Allow splitting function lines before the paremeter list

Posted: Sun Oct 16, 2016 9:29 am
by Mistrel
Just had a line like this with a floating variable and it looks so weird:

Code: Select all

String.s=SomeReallyLongLine.s+
  String.s

Re: Allow splitting function lines before the paremeter list

Posted: Thu Jun 07, 2018 5:18 pm
by Mistrel
I would still really love to see this at some point.

Re: Allow splitting function lines before the paremeter list

Posted: Thu Jun 07, 2018 5:37 pm
by NicTheQuick
+1

Re: Allow splitting function lines before the paremeter list

Posted: Tue Jun 12, 2018 8:10 pm
by Trond
Mistrel wrote:Just had a line like this with a floating variable and it looks so weird:

Code: Select all

String.s=SomeReallyLongLine.s+
  String.s
I would have written it like this:

Code: Select all

String.s = SomeReallyLongLine.s + 
           String.s

Re: Allow splitting function lines before the paremeter list

Posted: Wed Jun 13, 2018 9:11 am
by NicTheQuick
I would like to write it this way

Code: Select all

String.s = SomeReallyLongLine
         + String

Re: Allow splitting function lines before the paremeter list

Posted: Wed Jun 13, 2018 9:51 am
by Marc56us
String.s = SomeReallyLongLine
+ String
This is not possible (IMHO) because the precompiler would have to read the following line each time (not to think that it is a typo error)

In my opinion, it would be easier for the team to implement the classic basic line continuation character

https://docs.microsoft.com/en-us/dotnet ... ts-in-code

"To break a single statement into multiple lines
Use the line-continuation character, which is an underscore (_), at the point at which you want the line to break. The underscore must be immediately preceded by a space and immediately followed by a line terminator (carriage return).
"

PS. Some other languages and script uses \ instead of _

Re: Allow splitting function lines before the paremeter list

Posted: Wed Jun 13, 2018 11:54 am
by Dude
Marc56us wrote:In my opinion, it would be easier for the team to implement the classic basic line continuation character
That's been discussed many times before and the decision was made not to do it. Sad, I know. :(

Re: Allow splitting function lines before the paremeter list

Posted: Wed Jun 13, 2018 1:15 pm
by blueb
Al_the_dutch's suggestion makes the most sense:

see: viewtopic.php?p=515024#p515024

Re: Allow splitting function lines before the paremeter list

Posted: Wed Jun 13, 2018 1:36 pm
by Marc56us
Yes,
however, I think it is more logical and shorter to use the classic syntax of all basic languages (VBS, VB, VBA): _
(space + underscore)

This character also has the advantage that it has no PB meaning, unlike '\' which is used for structures.
so no need to add directives like "Enable LineContinuation"

:idea: :?: :wink:

Re: Allow splitting function lines before the paremeter list

Posted: Wed Jun 13, 2018 4:03 pm
by Trond
Marc56us wrote:This character also has the advantage that it has no PB meaning, unlike '\' which is used for structures.
Underline is a legal variable name in PB, so that isn't going to work.