Use spaces by default

Bug #957309 reported by Danielle Foré
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Scratch
Fix Released
Low
Unassigned

Bug Description

Since the majority use case for Scratch will most likely end up in the code editing realm, we should default to using spaces instead of tabs to be compliant with our coding guidelines.

Tags: defaults
tags: added: defaults
Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

Doesn't sound like a good idea. Not only elementary coding will happen in elementary OS. I'd prefer tab to be tab by default.

Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

In IRC just now, 15 minutes into debugging Python script:
voluntatefaber> shnatsel: my fault! I used 4 spaces instead of tabs

Revision history for this message
Mario Guerriero (mefrio-g) wrote :

It is better to use tabs by default because they are necessary in some languages (like in Python) and work however with all of them

Changed in scratch:
status: New → Won't Fix
Revision history for this message
Kai (mvai073) wrote :

Actually, in Python the advice is to use spaces instead of tabs. See http://www.python.org/dev/peps/pep-0008/, where the designer of Python tells us to "Use 4 spaces per indentation level." For Haskell, it is also prefered to use spaces (http://urchin.earth.li/~ian/style/haskell.html). In short "tabs are evil" (http://www.emacswiki.org/emacs/TabsAreEvil).

Unless the user is coding in Whitespace (http://en.wikipedia.org/wiki/Whitespace_%28programming_language%29), changing tabs to spaces is highly preferable.

Also, it seems appropriate to remove trailing whitespace by default.

Revision history for this message
Mario Guerriero (mefrio-g) wrote :

When I learnt Python my tutorial said that the tabs are necessary in Python but however I already think that have tabs activate by default isn't bad. The 'tab' key button is supposed to insert tab, not spaces that have the 'space' key button.

Revision history for this message
Danielle Foré (danrabbit) wrote :

I think this sounds like you're trying to optimize for an edge case.

I believe the majority usage of Scratch on elementary OS would be just fine with spaces and it would go well with the majority coding guidelines.

This is just one more of "the little things" that stops developers before they can start coding. It's really lame to have to add "flip the switch to spaces" in the developer guide when it's our own app on our own OS.

If for whatever reason a developer needed to have tabs instead of spaces (which I do believe is the minority case), there's no reason they can't go to preferences and flip that switch.

Another option would be to have tabs and spaces switch intelligently. So for any language where spaces actually did cause some compiling problems, we could enforce tabs.

Revision history for this message
Andrea Basso (voluntatefaber) wrote :

If the problem is only about programming, we could have the "spaces instead of tabs" added by the euclide plugins.

We should think what's the best default for the average Joe, not a programmer. Scratch is a text editor, not IDE, we have euclide for that.

Revision history for this message
Mario Guerriero (mefrio-g) wrote :

Dan I said this only for a reason of consistency ("The 'tab' key button is supposed to insert tab, not spaces that have the 'space' key button") but however, following also Andrea, scratch can use spaces by default

Changed in scratch:
status: Won't Fix → Confirmed
importance: Undecided → Low
milestone: none → luna-beta1
Changed in scratch:
status: Confirmed → Fix Committed
Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

This will be fine for files started from scratch, but for files which originated elsewhere 4 spaces instead of tabs might be a really bad idea.
I'd expect tab key is expected to insert a tab. If my coding style requires spaces instead of tabs, I'll check the text editor settings for sure. However, if my hypothetical coding style requires tabs, I'd expect tab key to insert tabs and wouldn't check what's really set in the settings. So please, don't screw people hacking something aside from elementary.
IMHO the best way to solve this is to add coding style presets to Granite.

Changed in elementaryos:
status: New → Opinion
no longer affects: elementaryos
Changed in scratch:
milestone: luna-beta1 → 1.1
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.