Page 1 of 3

[Implemented] Very long statements

Posted: Sun Jun 15, 2003 8:23 pm
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

Posted: Sun Jun 15, 2003 8:51 pm
by Revolver
talk about ugly code

Posted: Sun Jun 15, 2003 8:57 pm
by WolfgangS
LOL agreed ;)

Posted: Sun Jun 15, 2003 9:04 pm
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.

Posted: Wed Jun 18, 2003 11:52 am
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.

Posted: Wed Jun 18, 2003 1:23 pm
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

Posted: Wed Jun 18, 2003 5:01 pm
by Fred
I agree with Inner, I think I will implemente it like that.

Posted: Wed Jun 18, 2003 7:48 pm
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...

Posted: Wed Jun 18, 2003 9:26 pm
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.

Posted: Tue Jul 01, 2003 10:22 am
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.

Posted: Tue Jul 01, 2003 4:14 pm
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 , :)

Posted: Tue Jul 01, 2003 5:38 pm
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.

Posted: Tue Jul 01, 2003 9:11 pm
by CoderLaureate
IMHO, using a pipe '|' wouldn't be much more different then using the unserscore '_' to break a line.

Posted: Wed Jul 02, 2003 12:05 am
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)

Posted: Wed Jul 02, 2003 10:27 am
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