It is currently Tue Sep 17, 2019 5:35 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Allow splitting function lines before the paremeter list
PostPosted: Mon Sep 19, 2016 12:48 am 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3240
I'm not sure when we got this feature but I just now realized that we can split lines up like this:

Code:
Debug 1 +
  2 + 3


Then I thought I would finally get to split up my function declarations and definitions like so:

Code:
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.

_________________
Image


Last edited by Mistrel on Thu Jun 07, 2018 5:17 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Allow splitting function lines before the paremeter list
PostPosted: Sat Oct 15, 2016 1:40 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3240
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:
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:
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.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Allow splitting function lines before the paremeter list
PostPosted: Sun Oct 16, 2016 9:29 am 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3240
Just had a line like this with a floating variable and it looks so weird:

Code:
String.s=SomeReallyLongLine.s+
  String.s

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Allow splitting function lines before the paremeter list
PostPosted: Thu Jun 07, 2018 5:18 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3240
I would still really love to see this at some point.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Allow splitting function lines before the paremeter list
PostPosted: Thu Jun 07, 2018 5:37 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jun 22, 2003 7:43 pm
Posts: 426
Location: Germany, Saarbrücken
+1

_________________
Electronics, Crazy & Interesting Stuff, all that with text, image and sound? Click here!

The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.


Top
 Profile  
Reply with quote  
 Post subject: Re: Allow splitting function lines before the paremeter list
PostPosted: Tue Jun 12, 2018 8:10 pm 
Offline
Always Here
Always Here

Joined: Mon Sep 22, 2003 6:45 pm
Posts: 7439
Location: Norway
Mistrel wrote:
Just had a line like this with a floating variable and it looks so weird:

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


Top
 Profile  
Reply with quote  
 Post subject: Re: Allow splitting function lines before the paremeter list
PostPosted: Wed Jun 13, 2018 9:11 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jun 22, 2003 7:43 pm
Posts: 426
Location: Germany, Saarbrücken
I would like to write it this way
Code:
String.s = SomeReallyLongLine
         + String

_________________
Electronics, Crazy & Interesting Stuff, all that with text, image and sound? Click here!

The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.


Top
 Profile  
Reply with quote  
 Post subject: Re: Allow splitting function lines before the paremeter list
PostPosted: Wed Jun 13, 2018 9:51 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Feb 08, 2014 3:26 pm
Posts: 632
Location: France
Quote:
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/visual-basic/programming-guide/program-structure/how-to-break-and-combine-statements-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 _

_________________
English is not my native language, I use an online translator


Top
 Profile  
Reply with quote  
 Post subject: Re: Allow splitting function lines before the paremeter list
PostPosted: Wed Jun 13, 2018 11:54 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1896
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. :(


Top
 Profile  
Reply with quote  
 Post subject: Re: Allow splitting function lines before the paremeter list
PostPosted: Wed Jun 13, 2018 1:15 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 2:15 pm
Posts: 819
Location: Cuernavaca, Mexico
Al_the_dutch's suggestion makes the most sense:

see: https://www.purebasic.fr/english/viewtopic.php?p=515024#p515024

_________________
- It was too lonely at the top.


Top
 Profile  
Reply with quote  
 Post subject: Re: Allow splitting function lines before the paremeter list
PostPosted: Wed Jun 13, 2018 1:36 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Feb 08, 2014 3:26 pm
Posts: 632
Location: France
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:

_________________
English is not my native language, I use an online translator


Top
 Profile  
Reply with quote  
 Post subject: Re: Allow splitting function lines before the paremeter list
PostPosted: Wed Jun 13, 2018 4:03 pm 
Offline
Always Here
Always Here

Joined: Mon Sep 22, 2003 6:45 pm
Posts: 7439
Location: Norway
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye