hyperfiddle

http://hyperfiddle.net
2018-12-17T18:06:46.062200Z

@alexandrkozyrev A debate we are having internally is about how hyperfiddle eval currently returns Either Left(compiler error) or Right(result). We considered it might be nicer if we just returned an (ex-info) or the result. The problem is, coders might never see an ex-info in their testing, and thus write code that crashes in production because it assumed an ex-info never happened. Lifting everything into wrapper types forces the call site to handle the error

alexandrkozyrev 2018-12-18T15:29:56.082400Z

@danieljomphe we had “a vs [a]” discussion with Dustin, the essence is: why is it ok to accept dumb functions, functions that can’t wrap/unwrap input values

alexandrkozyrev 2018-12-18T15:32:23.082600Z

take Rich’s example: x -> y changed to x -> Maybe y and existing callers - break

alexandrkozyrev 2018-12-18T15:33:59.082800Z

in real life if someone gives a scissors you don’t really care about package (if any), you care about cutting

alexandrkozyrev 2018-12-18T15:35:41.083Z

much better notation (for callers) is something like: y <- whatever x

alexandrkozyrev 2018-12-18T15:36:54.083200Z

I do care about “y” so much that I will reap-off whatever apart to get “x”

alexandrkozyrev 2018-12-22T20:18:03.001300Z

can’t get rid of the thought that Rich was talking (Maybe Not) about poor cousins of Datomic - schema and select

alexandrkozyrev 2018-12-22T20:18:31.001500Z

and that Clojure/Datomic is a kind of false separation

danieljomphe 2018-12-17T19:22:08.063100Z

I'm pretty sure I'd see those ex-info at least a few dozen times while coding. 😄 ...I suppose you're rethinking this a bit because of Rich's keynote...

2018-12-17T19:22:49.063300Z

We are trying to find a worldview in which Rich is right! Haven't found it yet!

danieljomphe 2018-12-17T19:24:42.063500Z

Wow! I'm surprised by this. I loved Haskell's Maybe/Eithers until Rich said those things that he said. I was forced to recognize that C#/Kotlin's type system is better on that front, obviously.

2018-12-17T19:25:23.063800Z

We agree with the attribute centric worldview

2018-12-17T19:26:14.064Z

however, we have a function eval-str, would he like us to wrap the result in a map so we can name the result with an attribute?

danieljomphe 2018-12-17T19:26:28.064200Z

Not to put too much pressure on you, but I hope you'll write up your thoughts somewhere - I'd love to be exposed to your arguments, and not just me, but the public too.

2018-12-17T19:27:28.064400Z

Or perhaps he would like us to use metadata (a great idea!) but ........ to use metadata you need to wrap the result in a container

2018-12-17T19:28:55.064600Z

E.g. here – note the value is wrapped in :Error key https://twitter.com/dustingetz/status/1068513550753296384

2018-12-17T19:29:21.064900Z

Wrapping the return value of eval-str into {:Error x} is no better than wrapping it in a Left

2018-12-17T19:30:00.065100Z

Well, actually, maybe it is, i have not fully considered it until now

danieljomphe 2018-12-17T19:31:27.065300Z

His main goal is : whatever you do, if you change your API, do not break your existing clients. I think it's good to keep that in mind. Since you're already starting with a strict set of return value possibilities, you might be fine wrapping them in whatever (Either, or Map).

2018-12-17T19:32:02.065500Z

IMHO, That is not the use case that people use Either for. He has cherry picked the wrong use case

2018-12-17T19:32:34.065700Z

We are using Either to force the call site to write robust code that accounts for the possibility of error

danieljomphe 2018-12-17T19:32:57.065900Z

Yeah and he was more speaking about Maybe than about Either (although I've always struggled a bit remembering which one is which one)

danieljomphe 2018-12-17T19:33:59.066100Z

Your imposing an Either wrapper on us is no big deal, especially since we could write a macro that handles our error handling if we wanted.

2018-12-17T19:34:57.066300Z

it's not even imposed on userland, it's an internal API, but we suffer a great deal of pain writing funcool/cats everywhere in our internals that deals with Either types, and Rich's series of lectures on this subject have not demonstrated to me at least that he understands the problem we're trying to solve

2018-12-17T19:36:02.066500Z

We want badly to see a better way, it really hurts us having to deal with container types from clojure

danieljomphe 2018-12-17T19:37:34.066700Z

ok - I think I'll write past your real concerns, then - I think I don't have enough knowledge and experience to help you find a better way - I risk only repeating what Rich said, without really understanding your needs. 🙂

2018-12-17T19:38:42.066900Z

What would be perfect is, putting metadata on nil. That way we get clojure's nil punning philosophy (monadic short circuiting on errors with nice syntax) while also having the ability to collect the error messages and report them

2018-12-17T19:39:02.067100Z

But clojure understandably does not support metadata on host primitives

danieljomphe 2018-12-17T19:39:22.067300Z

haha, which would require a wrapper container on top of null, due to Java not being a truly OO system. 😄

danieljomphe 2018-12-17T19:41:55.067500Z

...ok so you really require some kind of wrapper. Now you've got a very concrete and specific one: Either. I could see some argument where switching to a flexible wrapper (a map) might give you something.

2018-12-17T19:42:33.067700Z

Yeah, interestingly cljs/eval i think returns a map

danieljomphe 2018-12-17T19:42:40.067900Z

Not sure if you'd need the "something", though.

2018-12-17T19:43:19.068100Z

The next thing we'd need to do is implement mlet, either/branch, fmap etc on the container type, which seems straightforward enough

danieljomphe 2018-12-17T19:44:26.068300Z

but you'd be in a parallel world instead of perusing the standard fonctions - I suppose you're already quite a lot in such a world with your usage of cats.

2018-12-17T19:45:07.068500Z

typeclass polymorphism isn't really something we need (e.g. having mlet work on arbitrary monad) – we can hardcode the utility lib

danieljomphe 2018-12-17T19:45:11.068700Z

that's what's annoying with custom types - they invade everything that must be redesigned to accommodate

danieljomphe 2018-12-17T19:47:04.068900Z

Now that I've reached my potential usefulness limit, I suggest you start a new thread to signify that new feedback might be welcome!

2018-12-17T19:47:18.069100Z

on r/clojure ?

danieljomphe 2018-12-17T19:47:52.069300Z

hmmm yes this would give a wider perspective

2018-12-17T20:54:46.071900Z

Just deployed changes to the links datamodel. • link/rel has been removed, use link/class for that now • * The following have been removed: hf/affix hf/detach hf/self hf/rel * Remaining link/class choices are: is hf/new, hf/remove, hf/iframe * link/class is now optional, we infer the correct semantics from context, only new/remove/iframe require additional specification

2018-12-17T20:55:58.072800Z

* link/path is no longer a path, but rather the ident of an attribute. So if you put a link at :neighborhood/district, it will appear for any :district at any depth in the pull

2018-12-17T20:57:02.073900Z

* fiddle/renderers can now much more easily name a link. Instead of requiring you to name links by :link/class you can now also name them by :fiddle/ident, :link/path (attribute), and also by :link/tx-fn (to name a button)

2018-12-17T20:58:23.075300Z

Data mode no longer automatically merges in extra links, it just uses your fiddle links, we have big plans for data mode in the future that are, dare I say it, compatible with REBL?

2018-12-17T21:01:07.075900Z

TLDR: Links are way way simpler, much more is inferred from namespace keywords than before

danieljomphe 2018-12-17T21:01:23.076300Z

does it mean that the hypermedia model gets down to 3-4 concepts instead of 7?

2018-12-17T21:01:32.076500Z

Yes

danieljomphe 2018-12-17T21:01:50.077Z

Hahaha I deferred learning those 7 a few months ago, you almost made my day hahaha

2018-12-17T21:02:05.077500Z

* link/formula is scheduled for removal, direction is don't use it (We aren't ready to hide it from UI yet)

2018-12-17T21:02:12.077700Z

lol

2018-12-17T21:35:51.078300Z

* txfn hacks have been cleaned up, e.g. this txfn is now clean: http://demo.hyperfiddle.net/:dustingetz!counter/#:hf.src!ns