Hacker News new | past | comments | ask | show | jobs | submit | ghosttie's comments login


Since there are no exceptions, in a try-else how can you tell what the error was?


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.


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.


How can it direct you to the nearest Chipotle if it doesn't know where you are? It must know who you are at least at the time of the query


Honestly expected a page that just said "No"



Yes.

In my opinion casinos take advantage of a loophole in human psychology to take money from people who can't afford it, so having anything to do with that is unethical.


So basically diceliving


About a year ago WeatherSpark got rid of their very useful dashboard - I particularly liked being able to see a combination of temperature and rain per hour for the next week.

There didn't seem to be an alternative (and there was a Reddit discussion full of people with the same problem) so I started making one.

It took me a year, but it's finally up and has its own domain and everything.

It uses the weather report API from Dark Sky, Google's chart API, free icons from Freepik and the free tier of Google App Engine. About the only thing I'm paying for is the domain name.

Because I'm using the Google chart API I'm limited in how much I can customize how it looks, but it's not too different from what I wanted.

If it sucks please let me know why :)


Accurate book recommendations - not what's popular, not something in the same genre as I've read, not by the same author I've read but something I'd actually want to read.

I think the reason this hasn't been done is that (like movies and music) books are so complex that it's hard to tell what someone liked about one book or disliked about another book, so it's hard to know what other books would have that same feature.

Which is why I think ML would be perfect for this - it's good at things like extracting common features, you just has to create one that can read and comprehend novels :)


Totally agree. Would love to see something like this.


People need to start saying what their product does on their website


I was disappointed that the landing page wasn't personalized as a demonstration


Actually, it is. We're currently running simple personalization campaign with two versions of landing pages which has different design, messaging, etc.


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

Search: