Re:Grain: A strongly-typed functional programming language f...
by c-smile on Tuesday July 31, 2018 @11:59AM
(#17654320)
IMO modern web language should have some notion of events as in my Sciter ( https://sciter.com/event-handling/ ) for example:
[ Parent
| on HN ]
Re:Grain: A strongly-typed functional programming language f...
by joehewitt on Tuesday July 31, 2018 @12:02PM
(#17654347)
YES. Every time I see a new language come out without first class event support it is obvious the creator never wrote a lick of front end code in their life.
Re:Grain: A strongly-typed functional programming language f...
by mkl on Tuesday July 31, 2018 @03:40PM
(#17656373)
Can you explain how these differ from ordinary callback functions?
I haven't done any web development to speak of, but I've done a fair bit of GUI stuff, doing things like this snippet appears to in languages that don't have "events" as a separate category of thing.
Re:Grain: A strongly-typed functional programming language f...
by c-smile on Tuesday July 31, 2018 @07:09PM
(#17658131)
This
observable.on("click", observerFunc);
// or observable.addEventListener(...);
is an executable statement. And this class Widget : Element {
event click { … observer's code … }
}
is a declaration.That executable statement needs to be called at some point of time. So the observable can be in two states - with and without that event handler.
While class declaration is an invariant (at least in Sciter) - as soon as element is in DOM it has that class and consistent set of event handlers in place. Such binding is done by, again, CSS declaration:
widget {
prototype: Widget url(path); // <widget> controller
display: block;
...
}
"I've done a fair bit of GUI stuff"AFAIR VB6 and Delphi allow to declare event handlers without explicit/runtime binding - that's close as a concept to the above.