Re: Just a little question before 4.0 will be released

new topic     » goto parent     » topic index » view thread      » older message » newer message

I forget one language, but one thing I enjoyed about it was it's multiline string had the option to strip the indent prefix. For instance:

sequence output 
if idx = 1 then 
    idx = idx + 25 
    output = #/Hello Mr. John Doe, 
 
This email is being generated to you for some purpose of 
which I have no clue. 
 
Thank you for your support, 
 
Mr. Jeff Doe 
/ 
else 
    idx = idx + 30 
    output = #/Hello Mr. John Doe, 
 
This email is being generated to you for some purpose of 
which I have no clue. 
 
I am very sad that you have choose not to support us, 
 
Mr. Jeff Doe 
/ 
end if 

The above is very difficult to read. Sure, you can create constants outside of the if or do other tricks to make it look a little better, but that also is very hard to read, here's an example of that:

sequence msg1 = #/ 
Dear Mr. John Doe, 
 
This message ...... 
 
Thank you.... 
 
Mr. Jeff Doe/ 
sequence msg2 = #/ 
Dear Mr. John Doe, 
 
This message .... 
 
Sorry.... 
 
Mr. Jeff Doe/ 

Now, what the language did that I am speaking of (wish I could remember which one it was):

if idx = 2 then 
    idx = idx + 25 
    output = #/ 
        #Dear Mr. John Doe, 
        # 
        #I am very happy for your support 
        # 
        #Mr. Jeff Doe 
        #/ 
else 
    .... more .... 
end if 

So, if the string starts with the magic hash, then all white space preceeding it is stripped. Maybe it could be the magic character that you choose:

sequence out = #/ 
    /Hello 
    /World 
    /Next line ends it. 
    // 

On the last line in that example, the first / sets the place that will be stripped, the last ends the string definition. Therefore there is no confusion as to if the / ends the string or is just a begining of string definition character.

Just thinking aloud. This syntax of course would not be required to be used, you could do as the first example on this post and just put your entire string on the first column, but for many, the above syntax will make the difference between something readable/maintainable and something that just causes mass confusion.

Jeremy

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu