Live data from Hacker News

The Pyret Programming Language

pyret.org

31–40 of 138 posts

Re: The Pyret Programming Language

#31

It seems pretty bad to have kebab-case identifiers in a language that also has an infix subtraction operator -. The only languages I know that allow kebab-case idents are lisps, where subtraction is (- prefix notation). From the examples: lam(actual): num-abs(actual - target) This is a new, even worse kind of "whitespace significance" than indentation. Is it a function called `num-abs` or a variable `num` minus `abs(…

Always requiring whitespace around infix operators is, in my opinion, easier to explain to people than "you can do whatever you want with the whitespace." It's consistent and regular. I don't think it's as much of an issue as you're making it out. Pyret is the result of decades of research in computer science education, helmed by Shriram Krishnamurthi, who was one of the original members of the Racket project (itself…

> Always requiring whitespace around infix operators is, in my opinion, easier to explain to people than "you can do whatever you want with the whitespace."

It might be easier to explain, but it also makes the code look ugly. Consider the expressions:

    a := b + c*d
    if e > f-g then ...
Here the * and - are more tighly bound than the + or >, and I'm using the whitespace to make that obvious.

Re: The Pyret Programming Language

#32

Earlier quoted context omitted.

IIRC, they're checked at run-time but not compile-time. And to avoid the speed issue (you're right: it really can get really slow), it only checks the top-level type. E.g. `List ` just checks that it's a list.

> they're checked at run-time but not compile-time Do they intend to add this? I think it would make a big difference. It would make thje language more like Haskell, where lots of bugs would be caught at compile time. > it only checks the top-level type. E.g. `List ` just checks that it's a list. That's fair enough because otherwise it might have to go though potentially very big data structures. Maybe there could be…

It is used to to teach children. Spoken the name sounds like pirate. No snark intended.

Re: The Pyret Programming Language

#33

It seems pretty bad to have kebab-case identifiers in a language that also has an infix subtraction operator -. The only languages I know that allow kebab-case idents are lisps, where subtraction is (- prefix notation). From the examples: lam(actual): num-abs(actual - target) This is a new, even worse kind of "whitespace significance" than indentation. Is it a function called `num-abs` or a variable `num` minus `abs(…

> It seems pretty bad to have kebab-case identifiers in a language that also has an infix subtraction operator -.

Indeed. What's wrong with using _ in identifiers?

Re: The Pyret Programming Language

#34

Earlier quoted context omitted.

Always requiring whitespace around infix operators is, in my opinion, easier to explain to people than "you can do whatever you want with the whitespace." It's consistent and regular. I don't think it's as much of an issue as you're making it out. Pyret is the result of decades of research in computer science education, helmed by Shriram Krishnamurthi, who was one of the original members of the Racket project (itself…

> Always requiring whitespace around infix operators is, in my opinion, easier to explain to people than "you can do whatever you want with the whitespace." It might be easier to explain, but it also makes the code look ugly. Consider the expressions: a := b + c*d if e > f-g then ... Here the * and - are more tighly bound than the + or >, and I'm using the whitespace to make that obvious.

Beauty lies in the eye of the beholder, ie aesthetics are subjective. For me, using proximity instead of parentheses to signify grouping would raise an eyebrow. I'd make an exception for cases of base*exponent, i think Python has it?

Re: The Pyret Programming Language

#35

My criticism is that this language is very similar to Python and might very well confuse students who ultimately have to switch to Python or other languages.

Students switching from this to a "real world language" would be disappointed if it does not have Algebraic Data Types, pretty sure about this. Once you learned about them in SML, OCaml, Haskell or one of their descendants, which include Pyret, Elm, ReasonML/ReScript, Rust and Purescript, you feel lucky if you can use Kotlin and approximate them with sealed classes. We will see, maybe C++, Java and C# add them in the next 5 years.

Re: The Pyret Programming Language

#36
post #34

Earlier quoted context omitted.

> Always requiring whitespace around infix operators is, in my opinion, easier to explain to people than "you can do whatever you want with the whitespace." It might be easier to explain, but it also makes the code look ugly. Consider the expressions: a := b + c*d if e > f-g then ... Here the * and - are more tighly bound than the + or >, and I'm using the whitespace to make that obvious.

Beauty lies in the eye of the beholder, ie aesthetics are subjective. For me, using proximity instead of parentheses to signify grouping would raise an eyebrow. I'd make an exception for cases of base*exponent, i think Python has it?

> Beauty lies in the eye of the beholder, ie aesthetics are subjective.

Then allow everyone to do things according to their own aesthetics.

Re: The Pyret Programming Language

#37
post #12

fun to-celsius(f): (f - 32) * (5 / 9) end It looks like abbreviated python.

It's more functional than python. The data construct is similar to variant types in OCaml.

Yep, to me it looks like OCaml made prettier (scriptier?) with ideas from Racket, Python and Ruby.

Re: The Pyret Programming Language

#38
post #32

Earlier quoted context omitted.

> they're checked at run-time but not compile-time Do they intend to add this? I think it would make a big difference. It would make thje language more like Haskell, where lots of bugs would be caught at compile time. > it only checks the top-level type. E.g. `List ` just checks that it's a list. That's fair enough because otherwise it might have to go though potentially very big data structures. Maybe there could be…

It is used to to teach children. Spoken the name sounds like pirate. No snark intended.

I'm not sure if this was intended as a reply to my comment.

In any case, I would suggest that a language be powerful and simple enough that it can do a wide range of tasks including teaching children, GUI apps, web apps, AI research, scripting, etc. Python does this and Pyret should aspire to do it too.

Re: The Pyret Programming Language

#39
post #34

Earlier quoted context omitted.

Beauty lies in the eye of the beholder, ie aesthetics are subjective. For me, using proximity instead of parentheses to signify grouping would raise an eyebrow. I'd make an exception for cases of base*exponent, i think Python has it?

> Beauty lies in the eye of the beholder, ie aesthetics are subjective. Then allow everyone to do things according to their own aesthetics.

I personally appreciate when languages have a consistent style. I think on the whole it helps readability more than it hurts.

We're enforcing whitespace around infix operators in Vale, and it's working pretty well. It's also enabling us to use for generics with no ambiguity =)

Post reply on HN