Indentation is not used consistently a.t.m.
SDF3 generates pretty-printers that indent elements with two spaces while Spoofax inserts a tab after, for example, an opening bracket.
This results in a mixture of spaces and tabs when refactorings or synchronized textual and graphical editors are used.

Personally I prefer the use of tabs by default, but either way, it should be used consistently.

Submitted by Oskar van Rest on 10 June 2013 at 22:51

On 11 June 2013 at 00:02 Vlad Vergu commented:

I think this is a great opportunity to restart this discussion. Please no dictatorial overrides this time.

My personal preference is towards tabs for indentation and spaces for alignment. But tabs for indentation, not a 3.5 spaces followed by a tab.

Since there is no dictatorship, here’s a survey: Please feel it in, it will help us take the decision.

On 11 June 2013 at 00:02 Vlad Vergu tagged rfc

On 11 June 2013 at 00:02 Vlad Vergu tagged error

On 11 June 2013 at 00:02 Vlad Vergu tagged !eelcovisser

On 11 June 2013 at 00:02 Vlad Vergu tagged !guwac

On 11 June 2013 at 00:02 Vlad Vergu tagged !gohla

On 11 June 2013 at 00:02 Vlad Vergu tagged !oskarvanrest

On 11 June 2013 at 00:02 Vlad Vergu tagged !dannygroenewegen

On 11 June 2013 at 12:21 Eelco Visser commented:

I did the survey, but under protest. It does not present a balanced analysis of the issue.

On 11 June 2013 at 12:43 Sebastian Erdweg commented:

My two cents: I think whitespace issues should be decided at the IDE level (per user) and simultaneously at the version-control level (per repository).

Once you have a nice abstraction for declaring the desired alignment of a language (SDF3), it should be possible to derive a formatter that supports different whitespace styles. (also think: characters per line)

On 11 June 2013 at 12:44 Danny Groenewegen commented:

My answers assume we are talking about experimental new languages, that do not have a working code formatter or generally accepted style.

PS What link shows the anwers?

On 11 June 2013 at 12:52 Eelco Visser commented:

I like the Go approach to formatting: provide a standard formatter that comes with the language and that is automatically applied when committing code to version control. The problem with everyone applying their own style is that it leads to continues conflicts.

A problem with tabs is that they don’t have standard way of displaying, whereas spaces do, assuming a proportional font, which is mandatory for code in my opinion. Even if you can set the display style for tabs in your editor, this does not guarantee appropriate display in other situations.

On 11 June 2013 at 14:18 Gabriël Konat commented:

We shouldn’t force language designers to force a style upon their users. Some language designers may want to do that, but some don’t. If you specify indentation in SDF3 it is possible to have configurable indentation formatting, like use x spaces or tabs. If hou want to enforce a particular style, these settings can be disabled and fixed to the values that the designer specifies.

The question whether we want to use tabs or spaces is not relevant for a generic formatter framework, but it is important for our own formatting guidelines. Like should we use spaces/tabs in the SDF/Stratego code that we have on the metaborg organization on github?

On 13 June 2013 at 21:58 Lennart Kats commented:

The idea was always that Spoofax editor services would use something like AutoEditStrategy.createIndentationLevel() that would respect the user’s Eclipse settings. But I’m not entirely sure if that works correctly atm :) Other than that, I really don’t care about tabs or spaces, just consistently use only one of them in a project. (I’m generally not a big fan of alignment or tabs+spaces alignment, but it’s been somewhat nice for Stratego assignments in the past.)

Log in to post comments