[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Wishlist.
- Subject: Re: Wishlist.
- From: Ori Bernstein <ori@xxxxxxxxxxxxxx>
- Date: Fri, 3 Jul 2015 21:38:26 -0700
- To: Ryan Gonzalez <rymg19@xxxxxxxxx>
- Cc: myrddin-dev@xxxxxxxxxxxxxx
On Fri, 3 Jul 2015 14:45:04 -0500, Ryan Gonzalez <rymg19@xxxxxxxxx> wrote:
> Interesting portion:
>
>
> http://blog.burntsushi.net/rust-error-handling/
> Informal intro to Rust-style error handling via monads, although the site
> avoids the word "monad" to avoid invoking excess fear.
http://git.eigenstate.org/ori/mc.git/tree/libstd/option.myr
http://git.eigenstate.org/ori/mc.git/tree/libstd/result.myr
http://git.eigenstate.org/ori/mc.git/tree/libstd/try.myr
The thing is that so far, it still feels clunky. What Rust does to help
is putting in macros. I really don't want arbitrary macros, but at the same
time, the kind of stuff that Haskell desugars to goes against the "spirit"
of the language:
> http://felix-lang.org/$/usr/local/lib/felix/felix-latest/share/lib/std/datatype/option.flx
> Felix implementation version of the above
Hm. They seem to have a number of interesting utility functions, at least. I'd
consider snarfing a few of those.
> f n = do
> a <- someFunction
> a + n
f n =
someFunction >>= (\a -> a + n)
Which is doable in Myrddin:
const f = {
-> std.bind(someFunction(), {
-> a + n
})
}
Chaining further gets ugly, though:
const f = {
-> std.bind(std.bind(std.bind(someFunction(), {
-> a + n
}), {b
-> b + n
}), {c
-> c + n
})
}
I've considered adding a 'flip' operator, eg, $ which would clean up
the syntax a little bit. Flip would basically chain two functions:
a $fn c
would be equivalent to
fn(a, c)
I might even have it allow extra arguments:
a $fn(c, d) b
But even then it isn't quite as generic as Haskell, looks kind of ugly, and
would make performance suck without lots of unimplemented optimizations.
> On Fri, Jul 3, 2015 at 2:11 PM, Ori Bernstein <ori@xxxxxxxxxxxxxx> wrote:
>
> > Wrote up a wishlist. Pretty much, it's a list of things that I'd like to
> > work
> > on at some point. Unless someone else gets to them first, of course.
> >
> > http://eigenstate.org/myrddin/wishlist
> >
> > --
> > Ori Bernstein
> >
> >
>
>
> --
> Ryan
> [ERROR]: Your autotools build scripts are 200 lines longer than your
> program. Something’s wrong.
> http://kirbyfan64.github.io/
--
Ori Bernstein