for what it’s worth, i’ve never had much luck with the jsnyder toolchain scripts on linux, nor had much motivation to try very hard since the atmel releases work fine.

the whole strategy of the Makefile seems kinda… brittle. combining specific arbitrary versions of gcc boostrap sources, with basically random versions of tools like texinfo

It’s handy because it does build a usable toolchain on OSX, which is very convenient. But I agree the Makefile is really hard to deal with. When it stops working I’ll replace it with the Atmel binaries and Vagrant / Docker / whatever the flavour of the month is.

@tehn, any interest in the getting travis set up?

https://travis-ci.org/samdoshi/libavr32/builds/118831379

at this point i’m still coming to grips with the submodule workflow-- minor confusion being worked out right now in fact while adding clock division to MP (which requires abstracting the external clock, which is a good thing in general).

i’ll check out travis!

I need to get the teletype codebase cleaned up a bit before I work on it, I’m going slightly crazy trying to follow control flow with the mixed up indentation.

So I was thinking, it doesn’t have to be a continuous affair, we could just take the hit once, sort the #defines out, and then all just try hard to keep it tidy looking. Thoughts?

@tehn, shall I just get on with it and run clang-format against the teletype codebase?

i say go. i can help sort out the messy things by hand as well (ie #defines)-- i’m pretty fast with sublime hotkeys

Works for me … 20

Is wrapping #defines in // clang-format off and // clang-format on an option? (Does that even work?)

EDIT: more on clang ignores in the docs.

Yeah, that occurred to me, it is a little irritating to have to baby the formatter that way. Good point though; probably better than having to fix things by hand.

Late to the party but yes please!

working with teletype code right now and the 80 column clang format is driving me a bit crazy - any opposition to changing it to 100? or even 110/120?

i could be ok with 100, though i understand the style guideline for 80.

what editor do you use, by the way?

(i’ll generally defer to @sam on these matters)

No opposition from me on switching to 100 columns.

I vote no. But if everyone else wants to…

IIRC I tried reformatting the code to 100 columns when I was initially fiddling with clang-format and rejected it in favour of 80 columns, 100 columns is a bit too hard to use on a 13" laptop screen in my opinion (esp, if you want 2 windows side by side). Horizontal scrolling in code is an awful thing to have to do.

The biggest reason to say no, is that if we change it to 100, clang-format will make the following changes and mess up the commit history.

 module/edit_mode.c       |  42 ++----
 module/flash.c           |  21 ++-
 module/globals.h         |   9 +-
 module/help_mode.c       |  31 ++---
 module/keyboard_helper.h |  15 +--
 module/line_editor.c     |   3 +-
 module/line_editor.h     |   3 +-
 module/live_mode.c       |   9 +-
 module/main.c            |  22 +---
 module/pattern_mode.c    |  28 ++--
 module/preset_r_mode.c   |  14 +-
 module/preset_w_mode.c   |   4 +-
 module/usb_disk_mode.c   |   9 +-
 simulator/tt.c           |   4 +-
 src/command.c            |   7 +-
 src/ops/ansible.c        | 328 ++++++++++++++++++++-------------------------
 src/ops/controlflow.c    |  45 +++----
 src/ops/delay.c          |  13 +-
 src/ops/hardware.c       | 122 ++++++++---------
 src/ops/justfriends.c    |  42 +++---
 src/ops/maths.c          |  99 +++++---------
 src/ops/metronome.c      |  35 +++--
 src/ops/op.c             | 116 ++++++++--------
 src/ops/op.h             |  37 ++----
 src/ops/patterns.c       | 226 +++++++++++++++----------------
 src/ops/queue.c          |  39 +++---
 src/ops/stack.c          |  24 ++--
 src/ops/telex.c          | 483 +++++++++++++++++++++++++++++++------------------------------------
 src/ops/telex.h          |   3 +-
 src/ops/variables.c      |  42 +++---
 src/scanner.h            |   3 +-
 src/state.c              |  31 ++---
 src/state.h              |  26 ++--
 src/table.c              |  89 ++++++-------
 src/teletype.c           |  25 ++--
 src/teletype.h           |  12 +-
 tests/op_mod_tests.c     |  20 +--
 tests/parser_tests.c     |   3 +-
 tests/process_tests.c    |  10 +-

The original Teletype code base had too much nesting (sorry @tehn), keeping the lines short helps to prevent that IMO. Anyway it can’t be as bad as the Linux style guide, which is 80 columns wide, but with 8 character tabs…

@scanner_darkly is there something in particular that’s causing problems?

i use notepad++, it has language specific formatting and colour coding / auto completion / plugins, and i just like it in general.


@sam - you suggested 100 upthread, curious what changed your mind? smaller screen argument makes sense (as it happens i’m planning to spend several hours coding on my 13" laptop, so i should be able to understand this concern better, especially since i do use 2 windows side by side all the time). but 80 still feels so limited. take this code for instance:

if the limit was 90 characters the method above wouldn’t need to use 2 lines for 207/208, 212/213, 218/219. to me breaking those lines in 2 is a poor trade off - that extra millisecond it takes when you just need to quickly scan some code adds up. and teletype code has a lot of examples like this, since there are many deep nested structures. op_ definitions is another example (i doubt you would need to check those declarations once they’re done, those really ought to be behind clang-format off i think…):

re: git - why would it mess up the commit history? it can take longer to do a blame but you can still track any changes, no?

i’m okay with leaving it as 80 if you prefer (and several hours on a laptop might change my mind about increasing it), and i refactored some of my code to take advantage of #define to make some lines shorter, so it’s less of a problem now (and there is always clang-format off option for where it makes sense).

I tried both of them out. 100 felt too wide, 80 seemed a lot nicer. Given that 80 char columns is still considered the ideal by cleverer people than me, I just went with the flow.

I’ve generally become a big fan of 80 char columns, I used to code in Visual Studio a lot, with ridiculously long lines of code and a tiny font. These days I much prefer a really big font and a narrow width, I find it a lot more relaxing.

Part of the issue here is that clang-format has a “take it or leave it attitude”, the example you gave could probably be formatted differently within the 80 characters and be more readable, but we don’t get that choice.

I’m just talking about it messing up blame.

Blame is incredible useful, particularly when you’re new to a codebase, GitHub’s blame view particularly (at least it is to me). It shouldn’t be discounted how useful these tools can be to new contributors.

Have a go for a bit, particularly on the smaller screen. If you still feel really strongly about it, then the best I can suggest is we have a vote amongst the contributors. That way I can vote no and not feel quite so bad about saying no.

(or alternatively @tehn can pull BDFL privileges and just tell us what to do)

git blame - you can exclude specific commits from blame, no?

i think at this point let’s just leave it as is. if i find it to be a problem i can always just run clang-format with a 100 or 120 setting while i work on the code and then reformat back with 80 before i do a pull request.

i’m for voting, but agreed with sam to give it some time. i am somewhat partial to 80 presently.

i’ve recently hardcore commited to vim. and it’s incredible. off topic, sorry. but sublime/atom etc encouraged my mac trackpad addiction, scrolling in all directions willy nilly. so i am partial to a restrained line length. that said, 100 would fit my dual terminal, but my eyes haven’t rebelled against my smallish font yet

Woohoo. I :heart: VIM.

I really recommend Practical Vim. The book is framed as a series of shortish ‘tips’, so it’s easy to dip in and out of.

On my 13" Macbook (retina), at 12pt Menlo (the smallest I will go), I can get 2 90 character wide columns side by side. Once you add in line numbers and a git indicator column, that only really leaves space for 80 columns of code.

80 worked just fine for me. I tend to do a lot of work on long plane flights with liquid assistance. The code fits nicely on my 13" laptop using Sublime.

Once again, @sam, thanks for all of the extra effort put into the tests, formatting, documentation, reorganization, optimization, and clever macros have made the Teletype so much easier to contribute to. My previous integration for the expanders was a spaghetti mess through the code. When I refactored for the 2.0 beta, it was so clean and simple. I got to throw out all of the spaghetti and let out that satisfied “ahhhhh” when your refactor to fewer lines.

2 Likes