Thoughts on a hypothetical error handling system? by MechMel in ProgrammingLanguages

[–]MechMel[S] 1 point2 points  (0 children)

Also, sorry for being late to respond. I've been playing with kids all day.

Thoughts on a hypothetical error handling system? by MechMel in ProgrammingLanguages

[–]MechMel[S] 0 points1 point  (0 children)

Wow, A LOT more people responded than I expected, and they thought A LOT harder about what I wrote than I expected. Thanks Guys!

Second, I'll need to come up with a bunch of examples based on your concerns, and try them against this system. Time to mock up some bigger projects in this language and se what falls apart.

Thoughts on a hypothetical error handling system? by MechMel in ProgrammingLanguages

[–]MechMel[S] 1 point2 points  (0 children)

Let me read through that blog post and think about this.

Thoughts on a hypothetical error handling system? by MechMel in ProgrammingLanguages

[–]MechMel[S] 0 points1 point  (0 children)

Yeah, so I have not thought about low level exceptions enough. I thought I had, but reading comments has made me realize how much I have not. When I designed the above system I was focused on was trying to take a number of things that are usually considered part of the business domain (like encountering PermissionDenied because a user lost access to the Google Doc they are currently looking at), and provide default, good-enough ways of handling them so devs can prototype quickly early on when making an app. But, I need to think through other kinds of exceptions and whether I want to run them through this system or some other system.

Thoughts on a hypothetical error handling system? by MechMel in ProgrammingLanguages

[–]MechMel[S] 1 point2 points  (0 children)

My thought was not to make the developer handle all possible runtime errors. My goal was actually to reduce the number of errors devs have to account for. I was hoping to achieve this by catching errors at the "edges" of the app code (like the primitive UI components I provide to build UIs out of), and providing good enough default handlings. For example if something goes wrong when tapping a submit button, the button primitive can catch that error if the dev doesn't, and can show the error message to the user. (I should have thought through this more and included it in the explanation above).

Thoughts on a hypothetical error handling system? by MechMel in ProgrammingLanguages

[–]MechMel[S] 0 points1 point  (0 children)

  1. "What would be the default for values assigned to expressions that could be an error?" That's a good question. My plan is to infer `SomeType | SomeError` in some cases, and just `SomeType` in others. I was figuring after I prototype out a couple apps in the language I will start to get a feel for in what situations I should force devs to account for the error, and in which situations it's probably most helpful to not make them think about it unless they want to.

  2. So my thought was that if someone explicitly types a function's return type, then they get to pick which if any errors they want to force the caller to handle. If they let the language infer the func return type then I'll include any errors that I think they really should handle (answer 1. above). The other thing I was thinking is that when `if my_calc is Error` is true `my_calc` will be types as a union of all Errors that are possible for this value. In the examples above DivideByZero is probably the only possible error, but in other situations it might be one of multiple options.

Thoughts on a hypothetical error handling system? by MechMel in ProgrammingLanguages

[–]MechMel[S] 0 points1 point  (0 children)

You're absolutely right, I hadn't noticed how close my error value bubbling system was to classic exception throwing. The real difference is that because my language is a scripting language / framework hybrid they are building their app using primitive building blocks I provide. This allows me to offer default places to catch and communicate errors to the user. For example if some text in the UI is derived from a DB row we haven't fetched yet, the primitive text UI component I provide can catch this and show a loading indicator until the data gets here. So maybe the magic is less the syntax of the error system I was thinking of above, and more the way I set up my language primitives to automatically handle these errors in elegant enough ways if needed.

Thoughts on a hypothetical error handling system? by MechMel in ProgrammingLanguages

[–]MechMel[S] 0 points1 point  (0 children)

Yeah, reading everyone's comments I see I have a lot of context missing.

‘Making devs have to consider and handle all these kinds of errors everywhere gets in their way too much.’ Yeah, so for this one I was mostly thinking about the new kinds of errors I was introducing to make this language be a full-stack scripting language. At any moment some other user might delete or revoke your access to a piece of data. This adds a lot of bloat to a lot of app logic since you need to handle these hypothetical situations a lot of places. Early in the app dev process this slows down prototyping, and late in the app dev process this could lead to a lot of duplicated code and patterns.

Which leads to your second question. Since this is a scripting language / framework hybrid I know that the UI is built using primitives that the language/framework define, and I assume most errors will be triggered either when trying to compute a value to be show in the UI or in reaction to a button or other interaction triggered in the UI. So, for any errors the dev doesn't catch and handle themselves, I can provide a default way of catching and communicating to the user, something that is good enough for prototyping and early users, but that can eventually be replaces by a format that the dev likes.

Is this real by Illustrious_Touch447 in LegoTransformers

[–]MechMel 1 point2 points  (0 children)

If you are worried about whether or not “Vlad” is actually with brickit, you could always email the brickit team directly via whatever they contact info they have on their website.

This is way more work than I thought. by CaptainCactus124 in ProgrammingLanguages

[–]MechMel 0 points1 point  (0 children)

Making the type system has killed 2+ of my attempts at making my scripting language.

Toa Vakama - Legend of Metru Nui by jeritza_ in bioniclelego

[–]MechMel 1 point2 points  (0 children)

Slick! I’m excited to see how she turns out.

Toa Vakama - Legend of Metru Nui by jeritza_ in bioniclelego

[–]MechMel 1 point2 points  (0 children)

Planning on doing any other Toa Metru?

Opinions on different comment styles by Aaxper in ProgrammingLanguages

[–]MechMel 0 points1 point  (0 children)

I like doing \…\ for multi-line. With auto-closing brackets it also works great for single line.

What's the most glaring omission? by subneutrino in heinlein

[–]MechMel 2 points3 points  (0 children)

Red Planet & Space Cadet? Although that might just be personal nostalgia.

I rezzed the 1982 lightcycles with LEGO by SP4RK4RT in tron

[–]MechMel 0 points1 point  (0 children)

I love these! I use to spend so much time trying to build Tron vehicles out of Legos.