It is currently Mon Dec 11, 2017 1:25 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Improved line continuation
PostPosted: Sat Nov 22, 2014 1:36 am 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3108
Currently we do not have line continuation for all available operators. Extending support for the rest of them would help to be consistent.

I would also like for the '\' character to denote a newline, as this is both customarily and widely used within the Unix platform, which includes Linux, OSX, BSD, etc.

The idea is that '\' is considered a line continuation when it appears at the very end of a line with preceding whitespace and is left-adjacent to a newline. This would also be fairly clear as the '\' character is used for accessing structure members

Unfortunately, this might not be straightforward as the current evaluation of '\' allows for whitespace on either side. I would recommend that this behavior be removed if this suggestion were to be considered.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Sat Nov 22, 2014 12:12 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Jan 21, 2011 8:25 am
Posts: 1007
Location: 'stralia!
I agree and I think '\' would be a good choice. The ambiguity problem could be resolved
if the parser just checked whether else other than whitespace. If there is anything else,
'\' is the structure access operator, otherwise it's the new-line indicator.

I think the current behavior is a little restricted and not flexible enough, so I +1 this.

_________________
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds


Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Sat Nov 22, 2014 12:17 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Fri Apr 25, 2003 5:24 pm
Posts: 7581
There's currently too many line-continuation characters as it is.
When the feature got added, I was excited, but shocked to see
about 5 supported.

Maybe the feature could be changed to use only one character
that the user can specify themselves in the prefs. Then, if the
last two characters of any line end with a space + that char,
the line continues.

I personally would set my prefs to use space + underscore,
just like Visual Basic. Anyway, just an idea. :)

_________________
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.


Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Sat Nov 22, 2014 1:10 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Jan 21, 2011 8:25 am
Posts: 1007
Location: 'stralia!
A preference setting would be a terrible idea as it would break all compatibility.
Currently, PB just checks whether the last character is an operator and then continues
to parse the expression on the next line if it found one.

_________________
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds


Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Sat Nov 22, 2014 1:15 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3108
I would honestly prefer to use only the '\' character for line continuation to remove ambiguity. It makes more sense to have just a single line continuation operator rather than several, since we can't arbitrarily break a line at any given whitespace.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Sat Nov 22, 2014 1:20 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 07, 2007 3:25 pm
Posts: 3142
Location: Berlin, Germany
Mistrel wrote:
I would also like for the '\' character to denote a newline

In BASIC flavpours, '_' is traditionally used for this purpose. That's why I personally would prefer that character.

PB wrote:
There's currently too many line-continuation characters as it is.
When the feature got added, I was excited, but shocked to see
about 5 supported.

Currently, PB has no character that denotes a line-continuation at all.
The current principle is, that line-continuation is allowed after certain operators.
These operators can be in the middle of a line as well, though.

PB wrote:
Maybe the feature could be changed to use only one character
that the user can specify themselves in the prefs. Then, if the
last two characters of any line end with a space + that char,
the line continues.

... on the system of that very user.
All other users who would have defined a different line-continuation character in their prefs, would not be able to run that code.
So exchange of code (e.g. here on the forum) would be unnecessarily laborious.

_________________
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups


Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Sat Nov 22, 2014 1:28 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3108
Little John wrote:
In BASIC flavpours, '_' is traditionally used for this purpose. That's why I personally would prefer that character.


Considering this is the only flavor of Basic that I use on a regular basis, I wouldn't know. I find '_' as a line-continuation character to be an eyesore. Using '\' feels more graceful, as though it's directing my eyes downward as I glance over it. When I see '_' my brain hits against it like a brick wall. Can't go down-- there is a line in my way! :)

But then again, I also wish PureBasic supported OO programming. It's up to Fred in the end.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Sat Nov 22, 2014 1:38 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 07, 2007 3:25 pm
Posts: 3142
Location: Berlin, Germany
Mistrel wrote:
Little John wrote:
In BASIC flavpours, '_' is traditionally used for this purpose. That's why I personally would prefer that character.


Considering this is the only flavor of Basic that I use on a regular basis, I wouldn't know.

It's simply a matter of fact.

_________________
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups


Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Sat Nov 22, 2014 1:40 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3108
Little John wrote:
It's simply a matter of fact.


Don't rock the boat. :wink:

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Sat Nov 22, 2014 2:34 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Fri Apr 25, 2003 5:24 pm
Posts: 7581
I forgot that making it a pref would prevent code-sharing. Sorry!

_________________
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.


Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Mon Oct 17, 2016 9:29 am 
Offline
User
User

Joined: Mon Nov 11, 2013 11:07 am
Posts: 47
Location: Netherlands
Might

Code:
Enable LineContinuation " _" ; or " \"


be a solution that fits all needs and is simply to implement?

I do miss a line coninuation a lot and would be happy with any complete solution.

KR


Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Thu Nov 16, 2017 2:04 am 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3108
This is still very annoying.

See here:

Image

If this were on one line I'd have to scroll horizontally to see that the "if" statement was:

Code:
If Not CompareMemory() Or Not CompareMemory()


This looks like a good candidate for line splitting!


Code:
If Not CompareMemory() Or
  Not CompareMemory()


But I still have to scroll horizontally because I can't see if it's a logical OR or AND.

Sigh.

Wishing for the following syntax:

Code:
If Not CompareMemory() \
  Or Not CompareMemory()

_________________
Image


Last edited by Mistrel on Sat Dec 09, 2017 9:39 pm, edited 3 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Fri Nov 17, 2017 3:14 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 653
Location: right here
+1 for the \backslash (and not for the _underscore)


Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Fri Nov 17, 2017 7:13 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1039
Location: Germany
Please no '\'. To many key to pressed on macOS :mrgreen:

I think is not a problem with '{space}_' for line wrap

_________________
My Projects OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer /
PB v3.30 / v5.60 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: Improved line continuation
PostPosted: Sat Nov 18, 2017 12:26 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Apr 26, 2003 2:15 pm
Posts: 698
Location: Cuernavaca, Mexico
Al_the_dutch wrote:
Might

Code:
Enable LineContinuation " _" ; or " \"


be a solution that fits all needs and is simply to implement?

I do miss a line coninuation a lot and would be happy with any complete solution.

KR


Thanks Al_the_dutch. :)

I like your idea of a new command: EnableLineContinuation " _" (or other combination)

The user can do nothing (keep the existing code as is) or the user can override PureBasic's normal preference.

The EnableLineContinuation character(s) would stay in effect only for source code that contains this command.

This way code can be distributed without fear that it won't work on another machine. :)

_________________
- It was too lonely at the top.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: BorisTheOld and 2 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