Live data from Hacker News

Sylph: the programming language I want

eev.ee

11–20 of 119 posts

Re: Sylph: the programming language I want

#11
post #3

>If your language has braces, then you are indenting for the sake of humans (because humans are good at noticing alignment and edges), and bracing for the sake of computers. That’s double the effort for something as mundane as where a block ends. If they get out of sync, then your code naturally breaks in a way that’s very difficult for you to detect. No, I use braces for the computer, and the computer automatically…

The computer is really quite proficient at inferring block structure from indentation, and if you use a modern editor this structure is manipulated rather effortlessly. The main problem with indent oriented languages is that not everyone is or wants to use a modern editor. Then there are LISPers who think braces everywhere are a swell idea.

What's effortless is putting begin and end of blocks symbols only where they matter.

Haskell is particularly guilty of creating several different indenting possibilities, and does require constant intervention. Python is less bad, but still requires more effort than C for example.

Re: Sylph: the programming language I want

#12

Earlier quoted context omitted.

The computer is really quite proficient at inferring block structure from indentation, and if you use a modern editor this structure is manipulated rather effortlessly. The main problem with indent oriented languages is that not everyone is or wants to use a modern editor. Then there are LISPers who think braces everywhere are a swell idea.

What's effortless is putting begin and end of blocks symbols only where they matter. Haskell is particularly guilty of creating several different indenting possibilities, and does require constant intervention. Python is less bad, but still requires more effort than C for example.

You really have to design your language around it for it to work well. Haskell has a a lot of syntactic craziness in the name of simplicity.

Re: Sylph: the programming language I want

#13
post #3

>If your language has braces, then you are indenting for the sake of humans (because humans are good at noticing alignment and edges), and bracing for the sake of computers. That’s double the effort for something as mundane as where a block ends. If they get out of sync, then your code naturally breaks in a way that’s very difficult for you to detect. No, I use braces for the computer, and the computer automatically…

The computer is really quite proficient at inferring block structure from indentation, and if you use a modern editor this structure is manipulated rather effortlessly. The main problem with indent oriented languages is that not everyone is or wants to use a modern editor. Then there are LISPers who think braces everywhere are a swell idea.

> The computer is really quite proficient at inferring block structure from indentation, and if you use a modern editor this structure is manipulated rather effortlessly.

Nonsense.

Try pasting a block of Python into Hacker News and you get something that starts off like this:

import os import random def do_something(x): if x: fd = os.open(x)

and only gets worse. A language with braces/semicolons has no such problem; it is easier to communicate with others, and the absolute value of being able to communicate with others when starting a new language is exceptional.

Re: Sylph: the programming language I want

#14
post #3

>If your language has braces, then you are indenting for the sake of humans (because humans are good at noticing alignment and edges), and bracing for the sake of computers. That’s double the effort for something as mundane as where a block ends. If they get out of sync, then your code naturally breaks in a way that’s very difficult for you to detect. No, I use braces for the computer, and the computer automatically…

I like writing compilers, how do languages like Haskell and Python handle blocks-by-indentation? I figure you have some sort of INDENT token, but how do you know its width? Also, in specifying the grammar, with explicitly delimited blocks you just say `block := OPEN stmt_list CLOSE`. What about with indentation?

Re: Sylph: the programming language I want

#15
post #7

Earlier quoted context omitted.

> you have to cycle through all sensible indentations What? My editor indents stuff for me as per PEP8. I don't have to think about it. Why do you?

def fun(): for x in xs: if a: b c There's no way for an editor to know where to re-indent c to. You have to cycle through the indents manually.

How did you end up with c there, honestly? It's not a thing that's ever happened to me.

Re: Sylph: the programming language I want

#16
post #3

>If your language has braces, then you are indenting for the sake of humans (because humans are good at noticing alignment and edges), and bracing for the sake of computers. That’s double the effort for something as mundane as where a block ends. If they get out of sync, then your code naturally breaks in a way that’s very difficult for you to detect. No, I use braces for the computer, and the computer automatically…

The computer is really quite proficient at inferring block structure from indentation, and if you use a modern editor this structure is manipulated rather effortlessly. The main problem with indent oriented languages is that not everyone is or wants to use a modern editor. Then there are LISPers who think braces everywhere are a swell idea.

The only thing superior to Sexps is Forth. Mechanical syntax forever.

Re: Sylph: the programming language I want

#17
post #13

Earlier quoted context omitted.

The computer is really quite proficient at inferring block structure from indentation, and if you use a modern editor this structure is manipulated rather effortlessly. The main problem with indent oriented languages is that not everyone is or wants to use a modern editor. Then there are LISPers who think braces everywhere are a swell idea.

> The computer is really quite proficient at inferring block structure from indentation, and if you use a modern editor this structure is manipulated rather effortlessly. Nonsense. Try pasting a block of Python into Hacker News and you get something that starts off like this: import os import random def do_something(x): if x: fd = os.open(x) and only gets worse. A language with braces/semicolons has no such problem;…

> A language with braces/semicolons has no such problem; it is easier to communicate with others

If someone posts more than two lines of practically any curly-brace language as one line, it's illegible. Yes, you can pull it into an editor and fix it automatically, but it's a huge waste of time that is best fixed by simply posting the code properly in the first place.

Re: Sylph: the programming language I want

#19
The inference example is actually a good illustration for why you want to add types to a function's signature.

As the author mentioned, a machine can look at how the arguments are used and make some educated guesses. The big problem is that humans have to do the same.

That's why I like optional types à la Dart. Not only do they help with static analysis, they also act as documentation.

With a good editor, this documentation is right at your fingertips. When you type a function's name, a call-tip will remind you of the expected arguments. If you've added type annotations, the types will be there, too.

Re: Sylph: the programming language I want

#20
post #7

Earlier quoted context omitted.

> you have to cycle through all sensible indentations What? My editor indents stuff for me as per PEP8. I don't have to think about it. Why do you?

def fun(): for x in xs: if a: b c There's no way for an editor to know where to re-indent c to. You have to cycle through the indents manually.

Perhaps I misunderstand, but vim, not a particularly uncommon editor, treats backspace at the start of a line by removing one indent level.

So, you're at `b`, you hit enter: next line, same indent level. Now you hit backspace: indent level matches `if`. Again: indent level matches `for`. Type c, there it is.

If you had curly braces, you'd use } instead of backspace. Literally the same number of keystrokes, no?

Or were you talking about something else and did I misunderstand?

Post reply on HN