Hacker News new | past | comments | ask | show | jobs | submit login

But if you write instead

  a := b+c * d
you aren't going to get an error. You're just going to get awfully surprising behavior, because you may think you were expressing one precedence with the spaces but the language has its own mind and doesn't care.

In contrast, Pyret doesn't bind anything more tightly than anything else. You parenthesize to make your intent clear.

If your expression gets too large, you should consider breaking it down with names for the intermediates. That will improve its readability by others anyway.




Your argument is that a language shouldn't have a feature, because that feature can be misused in order to make the program hard to understand.

But this is a bad argument, as it could apply to any language feature. E.g. I could write a program:

    def add(a, b):
        return a - b
Here I've called it "add" but it does subtraction. By your argument, we should ban functions having meaningful names, as people could use a misleading one.

> Pyret doesn't bind anything more tightly than anything else

So all dyadic operators have the same precedence, like in Smalltalk? How horrible.

> You parenthesize to make your intent clear.

More likely I write my code in something other than Pyret, to make my intent clear.


A space-aware syntax can allow optional spacing around operators but make it an error if it does not respect the precedence hierarchy or is deemed inconsistent by other rules.


I believe fortress did that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: