11 ms·
You're conflating two things. Indentation can be enforced without being semantic. In Python, indentation is semantic: if you move certain statements two lines o
by skrishnamurthi 10y ago
You're conflating two things. Indentation can be enforced without being semantic. In Python, indentation is semantic: if you move certain statements two lines out, you've changed the meaning of the program.
In Pyret, our goal is to enforce indentation but never make it semantic: i.e., there's an unambiguous place for every bit of code. You can select-all and hit Tab in the Pyret editor and it'll reindent your whole program according to the rules. We just haven't yet implemented the checker for these rules (in part because we still don't all agree on exactly what they will be). Once we agree, the program you wrote would be a syntax error, but a user could have the system automatically indent it for them to make it right. (Even now, they can have the line be automatically indented for them.)