Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Blocks outside the box

 [1/8] from: Carl::rebol::com at: 12-Jul-2003 2:35


Interesting title, don't you think? I don't want to start religion wars, but the correct way to write REBOL blocks is: [ item1 item2 ] Not: [ item1 item2 ] The reason is that the container (the box) is not the contents. Both the [ and the ] belong to the higher layer of the structure, not one to the higher layer and the other to the lower layer. That's why we wrote a style guide from the start. It's here if you've not seen it: http://www.rebol.com/docs/core23/rebolcore-5.html#sect5.1. Please no flames, no religion. I've been around the block too many times. (Hey, good pun, but not intended.) Yes, you are free to do it however you want in your own code, but the standard is what we use at RT. -Carl

 [2/8] from: Al:Bri:xtra at: 12-Jul-2003 22:07


Carl pointed out:
> The reason is that the container (the box) is not the contents. Both the
[ and the ] belong to the higher layer of the structure, not one to the higher layer and the other to the lower layer. Given this Rebol script (all on one line): f: func ["Function Comment" String [string!] "Parameter Comment"] [print String] Would the appropriate formatting be like this? f: func [ "Function Comment" String [ string! ] Parameter Comment ] [ print String ] Perhaps I misunderstand? Andrew J Martin Asking difficult questions... ICQ: 26227169 http://www.rebol.it/Valley/ http://Valley.150m.com/

 [3/8] from: carl:cybercraft at: 24-Dec-2003 22:23


On 12-Jul-03, A J Martin wrote:
> Carl pointed out: >> The reason is that the container (the box) is not the contents.
<<quoted lines omitted: 16>>
> ] > Perhaps I misunderstand?
I hope so. :) I would write it so... f: func [ "Function Comment" String [string!] "Parameter Comment" ][ print String ] -- Carl Read

 [4/8] from: Al:Bri:xtra at: 12-Jul-2003 23:16


Carl Read wrote:
> String [string!] "Parameter Comment"
So why doen't these [] belong to the outer layer? :) Andrew J Martin ICQ: 26227169 http://www.rebol.it/Valley/ http://Valley.150m.com/

 [5/8] from: greggirwin:mindspring at: 12-Jul-2003 12:21


Hi Andrew, AJM> So why doen't these [] belong to the outer layer? :) I think the style guide lays things out pretty clearly. Where possible, an opening square bracket remains on the line with its associated expression. -- Gregg

 [6/8] from: Carl:rebol at: 12-Jul-2003 22:21


The rule applies to block level indentation, but at the same level, breaks are permitted. That is, you could write all of these: 1 [2 2] 1 1 [ 2 2 ] 1 1 [ 2 2 ] 1 ; (as in the case of more args to a func) Just not: 1 [ 2 2 ] 1 The problem here is that a scan of the page hides the second 1. There is no indentation visual hint that the code has returned to the prior level. -Carl

 [7/8] from: lmecir:mbox:vol:cz at: 13-Jul-2003 8:23


Hi Carl,
> The rule applies to block level indentation, but at the same level, breaks
are permitted.
> That is, you could write all of these: > 1 [2 2] 1
<<quoted lines omitted: 14>>
> ] 1 > The problem here is that a scan of the page hides the second 1. There is
no indentation
> visual hint that the code has returned to the prior level. > > -Carl
but this looks like an exception? 1 [ 2 2] -Ladislav

 [8/8] from: Carl:rebol at: 12-Jul-2003 23:18


>but this looks like an exception? > 1 [ > 2 > 2]
It's true that's in the manual, but I think it's a mistake and I don't personally use it anymore. Rather: 1 [ 2 2 ] eg.: emit [ <H2> "example" </H2> content <P> ] -Carl

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted