[Implemented] Very long statements

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
idStefke
User
User
Posts: 25
Joined: Sun May 04, 2003 10:01 pm
Location: BELGIUM

[Implemented] Very long statements

Post by idStefke »

Hey all

I want to like to see the next feature:

Example:

TextGadget(0, 5, 5, WindowWidth()-10, WindowHeight()-10, "XpmTool Lite v. 0.9"+Chr(10)+"View and convert between Xpm and Bmp files."+Chr(10)+"Written in PureBasic by El_Choni")

Change to _

TextGadget(0, 5, 5, WindowWidth()-10, _
WindowHeight()-10, _
"XpmTool Lite v. 0.9" _
+Chr(10)+ _
"View and convert between Xpm and Bmp files." _
+Chr(10)+ _
"Written in PureBasic by El_Choni")

Contantenation with strings : only : "&" symbool

Kind regards
Revolver
User
User
Posts: 22
Joined: Tue Apr 29, 2003 9:20 pm

Post by Revolver »

talk about ugly code
WolfgangS
Enthusiast
Enthusiast
Posts: 174
Joined: Fri Apr 25, 2003 3:30 pm

Post by WolfgangS »

LOL agreed ;)
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> talk about ugly code

Perhaps, but having a long line broken down can be very useful at times.
One immediate advantage is not having to horizontally scroll your source
code to see what's on the long lines. It means you don't have to reach for
your mouse, too -- which makes for faster and more convenient coding.
Last edited by PB on Thu Jun 19, 2003 3:13 am, edited 4 times in total.
User avatar
geoff
Enthusiast
Enthusiast
Posts: 128
Joined: Sun Apr 27, 2003 12:01 am
Location: Cornwall UK
Contact:

Post by geoff »

One immediate advantage is not having to horizontally scroll your source
code to see what's on the long lines.
Yes.

Especially with long API calls which you can't split onto 2 lines.
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

I agree, but not on the _ implymentation, same way that C does it would be fine..

Foo(arg1,
arg2,
arg3,
arg4,
....)

Would be neat
Fred
Administrator
Administrator
Posts: 18161
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

I agree with Inner, I think I will implemente it like that.
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Fred wrote:I agree with Inner, I think I will implemente it like that.
No, that not good. Then you must implant a Line-End-Char and thats isn't good.
or what is the diffrent between

Code: Select all

if a=10
  b=11
endif
and

Code: Select all

if a=10 b=11 endif
when no lineend is a lineend

Thats why, c and Pascal has a line-end-Char (;)

A link-Char for PB would be nice. "_" don't look nice... but which char is free?

Edit: Ok, the "," would be a seperator of parmeters and a linelinker...
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

I think it's a good idea, Fred. I would also like that the editor allowed word wrapping, but I know it's difficult to handle line content and indexes that way. Using Inner's method, at least we could see the entire code without having to scroll horizontally.
El_Choni
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

You could have a multiline paramater. Say |.

If a line begins with | then that line continues until a line is encountered that ends with |. Between the 2 |s any EOFs are ignored.

The | is only significant at the beginning and end of the line. Any |s embedded within the lines are treated as normal characters.
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

what happens in this condition then

OpenWindow(#DEWINDOW, 0, 0,640,400, #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget,file)

Very messy :), and would slow the preprocessor down something aweful.

As Fred said he liked the traditional way..

Code: Select all

Foo(apple,
      fruity,
      basket,
      food,
      fight)
however what would also be usefule is.

Code: Select all

OpenWindow(#DEWINDOW,0, 0,640,400,#PB_Window_SystemMenu
                                | #PB_Window_ScreenCentered
                                | #PB_Window_SizeGadget,file)

so you can break | into multipal lines as well as those , :)
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

I hadn't thought of the overloaded |. Perhaps [] instead or ASP style <% %>.

GPI points out the problem of allow breaks accross lines without a EOL character like ;.

It could work if the line breaks were only allowed within the brackets. ie.
Line breaks inside brackets = white space.
Line breaks outside brackets = EOL.

This would take care of GPIs scenario.
CoderLaureate
User
User
Posts: 50
Joined: Fri Apr 25, 2003 7:21 pm
Location: The World is my country, all mankind are my brethren, and to do good is my religion.
Contact:

Post by CoderLaureate »

IMHO, using a pipe '|' wouldn't be much more different then using the unserscore '_' to break a line.
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

Inner wrote:I agree, but not on the _ implymentation, same way that C does it would be fine..

Foo(arg1,
arg2,
arg3,
arg4,
....)

Would be neat
Yes, but not ALL the long lines are procedure calls. In my case sometimes are IFs and ELSEIFs or formulas that dosen't use commas. Another way is inside strings.

In those cases an underline could be usefull (specially in big strings)
ARGENTINA WORLD CHAMPION
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Ricardo,
It could work if the line breaks were only allowed within the brackets. ie.
Line breaks inside brackets = white space.
Line breaks outside brackets = EOL.
Any extended conditions could be placed inside brackets, and the linebreaks would therefore be ignored.

Regarding Strings, I think the heredoc format in PHP is great. That would be really useful if it was supported:

http://www.php.net/manual/en/language.t ... ax.heredoc
Post Reply