Live data from Hacker News

Introduction to the Pony programming language

opensource.com

71–77 of 77 posts

Re: Introduction to the Pony programming language

#71

Earlier quoted context omitted.

If you need to distinguish between different errors than a union type like (Result | ErrorA | ErrorB) should be used.

I mean like try if not x() then error end if not y() then error end else // which error happened? end

If you need to distinguish between error then that would inappropriate. Without a real example, I can't really say what the right approach would be.

Looking at your example, I would say, if you care about which error happened, you should be using separate try blocks.

Errors aren't meant for flow control like that so really, you shouldn't be indicating error inside a try like that.

One option that Pony could have gone with is to use union types to always indicate errors:

(My Result | MyError)

There's overhead to that though. You always have to match on the type. For situation where an error is unlikely, partial functions are nice. Partial functions are not exceptions though, and aren't designed to do flow control so trying to use like some might use exceptions (to do flow control) is going to be painful (as your example points out) because they weren't designed for that use case.

Re: Introduction to the Pony programming language

#72

Earlier quoted context omitted.

I mean like try if not x() then error end if not y() then error end else // which error happened? end

If you need to distinguish between error then that would inappropriate. Without a real example, I can't really say what the right approach would be. Looking at your example, I would say, if you care about which error happened, you should be using separate try blocks. Errors aren't meant for flow control like that so really, you shouldn't be indicating error inside a try like that. One option that Pony could have gone…

How about things like opening a file, where there could be a variety of reasons it could fail?

Re: Introduction to the Pony programming language

#73

Earlier quoted context omitted.

If you need to distinguish between error then that would inappropriate. Without a real example, I can't really say what the right approach would be. Looking at your example, I would say, if you care about which error happened, you should be using separate try blocks. Errors aren't meant for flow control like that so really, you shouldn't be indicating error inside a try like that. One option that Pony could have gone…

How about things like opening a file, where there could be a variety of reasons it could fail?

This might be a better conversation for IRC (you can find me on Freenode in #ponylang as SeanTAllen) as we are replying to each other fast enough to trigger the flamewar detector. Now that it is letting me reply...

You should use a union type for that situation. Note, the current File API in the Pony standard library doesn't do that and it's something that we intend to fix before version 1.0. At this point, now one has gotten frustrated enough with it to open an RFC to propose an updated API. Someone will at some point though. But... volunteer project, limited time, itch to scratch etc.

Re: Introduction to the Pony programming language

#74
This is not a great intro to Pony. The most interesting thing about Pony is how data permissions work and how that allows for safe shared memory (a place where Erlang can fall down for certain applications as data is always copied between actors with the exception of large binaries)

Unfortunately for me the language felt a bit big and like it was doing too much (I guess you could say Elixir is in that same boat and I eventually got over that). It has the same "kitchen sink" problem as C++ and Scala. The use case for safe shared memory is interesting though and I'm keeping an ear to the project in passing

Re: Introduction to the Pony programming language

#75

I was surprised to see such a long intro to a new language without any code samples. Did I miss something?

I, the author, don't find code samples particularly interesting. When I want to consider a language, I start by asking what the hard problems it solves are. Why would I want to learn this language? What does it give him, what is it better at than the languages I already know. Given that is my bias and I am the author, that is what I wrote about.

Was the article for you or an audience, what outcome are you trying to achieve, does your decision still hold true?

Re: Introduction to the Pony programming language

#77

Pony is a slang word in UK, not great choice for name.

Yes it does mean £25, but rarely used any more however the alternative is

Meaning: Rubbish; nonsense, or 'of poor quality'. Often shortened just to 'pony'.

What's the origin of the phrase 'Pony and trap'? This is Cockney rhyming slang - pony and trap -> crap.

Post reply on HN