Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: An idea for error handling that could work with Myrddin


Now, the other reservation I have with a system like this is that a simple
implementation implies a builtin, magic error type. I like being able to
return different unions. For example, I have:

	type bio.result(@v, @e) = union
		`Ok @v
		`Eof
		`Err @e
	;;

which I'm not sure should be less distinguished than

	type std.result(@v, @e) = union
		`Ok @v
		`Fail @e
	;;

(Although it could use a bit more consistency, I suppose).

I'm currently mentally poking at this to see if it's possible to keep
the benefits, but make it more general.

On Tue, 22 Mar 2016 10:36:03 -0500, Ryan Gonzalez <rymg19@xxxxxxxxx> wrote:

> Ack, I forgot that part. That's what happens when you try to do too much in
> one day. :/
> 
> I updated the article; here's a direct link to the new section:
> 
> http://kirbyfan64.github.io/posts/an-idea-for-concise-checked-error-handling-in-imperative-languages.html#sequencing
> 
> 
> On Sun, Mar 20, 2016 at 10:02 PM, Ori Bernstein <ori@xxxxxxxxxxxxxx> wrote:
> 
> > It looks interesting. One thought is that it seems you have only a single
> > expression. The usual gain for try/error style handling is that you can
> > have multiple things happen in one block, and break out early when you see
> > the first error. Something like:
> >
> >
> >     try
> >         fd = std.dial("tcp|host!port")
> >         std.write(fd, "header")
> >         std.write(fd, "body")
> >         std.read(fd, responsebuf[:])
> >         ...
> >     except thingy
> >         handle error
> >     ;;
> >
> > I might be misunderstanding, but I'm not sure if this is possible with your
> > proposed system?
> >
> > On Sun, 20 Mar 2016 18:34:15 -0500, Ryan Gonzalez <rymg19@xxxxxxxxx>
> > wrote:
> >
> > > I just put a new post on my web site:
> > >
> > >
> > http://kirbyfan64.github.io/posts/an-idea-for-concise-checked-error-handling-in-imperative-languages.html
> > >
> > > Although I used Crystal in the examples, I had Myrddin in mind. I just
> > was
> > > too lazy to think of how the semantics would be in a low-level language,
> > > and Crystal's syntax is close to Ruby, which is really well-known.
> > >
> > > But the idea could still apply well, especially since Myrddin has type
> > > inference like I mentioned. However, I'm not sure how exactly throwing
> > > errors would be, since, without some kind of copy constructor system, I
> > > could see it being somewhat hard to debug.
> > >
> > > Anyway, thoughts?
> > >
> > > --
> > > Ryan
> > > [ERROR]: Your autotools build scripts are 200 lines longer than your
> > > program. Something’s wrong.
> > > http://kirbyfan64.github.io/
> >
> >
> > --
> >     Ori Bernstein
> >
> 
> 
> 
> -- 
> Ryan
> [ERROR]: Your autotools build scripts are 200 lines longer than your
> program. Something’s wrong.
> http://kirbyfan64.github.io/


-- 
    Ori Bernstein

Follow-Ups:
Re: An idea for error handling that could work with MyrddinRyan Gonzalez <rymg19@xxxxxxxxx>
References:
An idea for error handling that could work with MyrddinRyan Gonzalez <rymg19@xxxxxxxxx>
Re: An idea for error handling that could work with MyrddinOri Bernstein <ori@xxxxxxxxxxxxxx>
Re: An idea for error handling that could work with MyrddinRyan Gonzalez <rymg19@xxxxxxxxx>