News for hackers. Stuff that matters.
Re:Ask HN: Anyone using proportional fonts for coding? by kazinator on Monday July 31, 2023 @11:07AM (#36943754)
Doesn't play nicely with aligned material.

Parallel definitions lined up for readability.

  #define AF_UNSPEC       PF_UNSPEC
  #define AF_LOCAL        PF_LOCAL
  #define AF_UNIX         PF_UNIX
  #define AF_FILE         PF_FILE
  #define AF_INET         PF_INET
  #define AF_AX25         PF_AX25
  #define AF_IPX          PF_IPX
  #define AF_APPLETALK    PF_APPLETALK
  #define AF_NETROM       PF_NETROM
  #define AF_BRIDGE       PF_BRIDGE
  #define AF_ATMPVC       PF_ATMPVC
  #define AF_X25          PF_X25
Similarly in structure definitions where there are line comments:

C preprocessor continuation backslashes.

  /* From some MD5 code */

  #define FF(a, b, c, d, x, s, ac) {                      \
    (a) += F((b), (c), (d)) + (x) + convert(u32_t, ac);   \
    (a) = ROTATE_LEFT ((a), (s));                         \
    (a) += (b);                                           \
  }

  #define GG(a, b, c, d, x, s, ac) {                      \
    (a) += G((b), (c), (d)) + (x) + convert(u32_t, ac);   \
    (a) = ROTATE_LEFT ((a), (s));                         \
    (a) += (b);                                           \
  }
Alignment in parallel definitions.

  struct netent {
    char *n_name;                 // Official name of network.
    char **n_aliases;             // Alias list.
    int n_addrtype;               // Net address type.
    uint32_t n_net;               // Network number.
  };
No, tabs will not fix this issue, unless everyone agrees on exactly the same font, and the same tab stops, in the same editor. What looks vertically aligned in your editor looks staggered in someone else's.

This kind of thing is not unheard of:m

  struct netent {
    char      *n_name;              // Official name of network.
    char     **n_aliases;           // Alias list.
    int        n_addrtype;          // Net address type.
    uint32_t   n_net;               // Network number.
  };
We have the identifiers of the declarators vertically lined up, but the pointer derivators hang to the left. Tabs will just not do this.

Proportional font coders are in the lunatic fringe.

All else being equal, do not hire.

Re:Ask HN: Anyone using proportional fonts for coding? by kazinator on Monday July 31, 2023 @07:09PM (#36950119)
Another thing that doesn't work with proportional fonts:

  function(arg1,
           arg2,
           arg3);
Note that this, and everything in my above comment, can work just fine with tabs used for indentation, and set to the developers' preference:

  [tab]struct netent {
  [tab]  char      *n_name;              // Official name of network.
  [tab]  char     **n_aliases;           // Alias list.
  [tab]  int        n_addrtype;          // Net address type.
  [tab]  uint32_t   n_net;               // Network number.
  [tab]};

  [tab]{
  [tab][tab]function(arg1,
  [tab][tab]         arg2,
  [tab][tab]         arg3);
Change tab size, alignment is fine. Change to proportional font, it all goes haywire.
Re:Ask HN: Anyone using proportional fonts for coding? by MathMonkeyMan on Friday August 04, 2023 @06:02AM (#36997757)
We could give up on thinking of code as:

- a sequence of characters and spaces

- a series of lines

- a fixed grid of characters and spaces

Instead, store code as a parse tree -- comments and all. Then we'd view and edit code using "WYSIWYG" editors solely. No more "cat" and "less", we'd need new tools. No more tty-like terminals, we'd need something more like a web browser.

It would cripple existing workflows and hinder compatibility, but the advantage is that "formatting" would be the viewer's preference. Forget about tab stops and fonts; think more like CSS. It's an extreme version of the tabs people's argument.

Word/Sheets documents come close, in a horrifying way. What I'm describing is more like Graphviz.