syntax: Drop support for tabs and multiple spaces #4

Closed Jookia opened this issue on 24 Aug - 3 comments

@Jookia Jookia commented on 24 Aug

Currently whitespace is specified as an arbitrary amount of new lines, tabs or spaces. This is the traditional view of whitespace, however people tend to use tabs and spaces as a tool to manage complexity using visual alignment.

It might be wise to deliberately disallow this so people have to use more accessible tools to handle complexity.

@Jookia Jookia add the syntax label on 24 Aug

Sure, that sounds like it could be a good idea... However, what would you propose instead of tabs or spaces ? We can't rely on symbols, or on tabs, or on spaces, so what to use then ?

Also, what about sighted people, won't this make code unreadable to them ?

Well we'd use spaces, but not multiple ones. Here's an example from Python of what I'm talking about:

var = do_thing(arg1, arg2,
                               arg4, arg5)

The second and third lines are continuations of the first, and the only way to know this is to read each line to see how it ends. Sighted/braille users don't have to do this because they can see the indentation indicating it's a continuation of a previous expression. With NewLang I think we could hit scenarios like this where people are tempted to do the same thing instead of refactoring code.

Another thing we could do is just make the syntax line based so things can't continue over the line. Instead we should perhaps have a better way to manage arguments passed to an action. Maybe we will end up having some kind of system where at the start of the line we have something like 'Cont' or 'Args' that indicates it continues the argument list, like this:

Subject Verb Arg1 Arg2 Arg3
Arg Arg4 Arg5

with keyword syntax sometime like:

Subject Verb Arg1 Arg2 Arg3
Arg Arg4 Is A
Arg Arg5 Is B
Arg Arg6 Is C

where Arg* are named arguments and A/B/C are variables. That could be a good compromise where we say 'the first three arguments don't require names but anything more complex requires you to use named arguments syntax'

@Jookia Jookia referenced the issue on 24 Apr

I've decided to go the other direction and just allow whatever spaces. Eventually I'll write a code formatter if things get out of hand.

@Jookia Jookia closed this issue on 24 Apr

No milestone
No one
2 participants
@Jookia @xogium