[Grace-core] Indentation

Andrew P Black black at cs.pdx.edu
Mon Feb 16 14:47:24 PST 2015


Indentation Questions

Q0  Do we care where closing braces go?

Do they always have to align with the indentation of the line that opened the brace, or do we allow them anywhere?

Q1 Indentation of continuation lines

Suppose we have a continuation line:

         (X + y).
                  foo {

where does the next line (the body of the block) go?  It has to be indented, because of the '{', but to the right of what?   The '(' on line 1 (because it's the indentation of the logical line that the block contents has to be to the right of)?   Or the 'f' on line 2 (because thats the line where the block opened?

Does the first rule make 

         (X + yVeryLong).
                  foo {
                  if (b) then {
                           ...
                  } else {
                           ...
                  }

legal?  I think that the above is visually confusing.  Do we want the student to write

         (X + yVeryLong).
                           foo {
                  if (b) then {
                           ...
                  } else {
                           ...
                  }

or


         (X + yVeryLong).
                  foo {
                           if (b) then {
                                    ...
                           } else {
                           ...
                           }

?

Q2.  Can a block have expressions on the opening line.

For example, in

         requestName { thing1
                  thing2
                  thing3
         }

is thing1 permitted?  If so, so thing2 and thing3 have to be verticlally below thing1, or is it ok to allow them to be as shown above?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailhost.cecs.pdx.edu/pipermail/grace-core/attachments/20150216/e752beb1/attachment.html>


More information about the Grace-core mailing list