Forking Typescript to make a strongly-typed Flapjax compiler?

72 views
Skip to first unread message

Peter Verswyvelen

unread,
Sep 9, 2015, 8:23:50 AM9/9/15
to Flapjax
I'm not sure if it is possible, but I think it would be super cool to have a FlapJAX compiler that does type checking? 

Would forking Typescript be a good idea for doing this? 


Arjun Guha

unread,
Sep 9, 2015, 8:59:26 AM9/9/15
to fla...@googlegroups.com
A typechecking Flapjax compiler would be awesome.

I'm sure you know this, but forking TypeScript could be a lot of work. It may be simpler to just hack the existing compiler, at least to get started.

Arjun

> On Sep 9, 2015, at 08:23, Peter Verswyvelen <bug...@gmail.com> wrote:
>
> I'm not sure if it is possible, but I think it would be super cool to have a FlapJAX compiler that does type checking?
>
> Would forking Typescript be a good idea for doing this?
>
>
>
> --
> --
> Flapjax home page: www.flapjax-lang.org
> Flapjax list: groups.google.com/group/flapjax
> Post: fla...@googlegroups.com
> Unsubscribe: flapjax-u...@googlegroups.com
> ---
> You received this message because you are subscribed to the Google Groups "Flapjax" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to flapjax+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Peter Verswyvelen

unread,
Sep 9, 2015, 10:15:37 AM9/9/15
to Flapjax
I'm not sure, but writing a good type checker for reactive systems is a very difficult and only recently "resolved" problem (at least if you want to disallow "spacetime leaks"); you might need a dependently typed system for that?

But indeed, Typescript wil not offer any dependent typing, so I answered my own question I guess ;-)

Leo Meyerovich

unread,
Sep 9, 2015, 11:30:09 AM9/9/15
to fla...@googlegroups.com

Sounds awesome!

It's probably enough to typecheck the generated code (and convert the runtime libs to TS, or at least for during type checking). 

My main concern would be encoding. Encode as a class Behavior that is a subtype of Event, and does that play nice w/ their generics system & all our sugar? 

Re:spacetime leaks, those don't exist in Flapjax's CBV model of FRP. In Rx parlance, every value is 'hot' :) So, generics/classes should be fine for what the lazy language systems worry about. There may still be a different (and lesser) kind of leak relating to lack of weak references. Awhile back I tried figuring out if WeakMap would help, but seemed close-but-no-cigar..

-  Leo

Peter Verswyvelen

unread,
Sep 9, 2015, 11:51:29 AM9/9/15
to fla...@googlegroups.com
Typechecking the output using TS sounds like a great idea! Then only the flapjax compiler would need to understand and keep Typescript's type annotations, otherwise typescript will infer the type "any" for many types, essentially doing no type checking.

Regarding the encoding, as far as I understand, a behavior is an event that has a garantees initial starting value in Flapjax? And events can cause glitches but behaviors can't? In FRP a behavior is continuous and has a starting value and an event is discrete and has no starting value. The two can be converted using "step initval evt" and "sample clock beh". But in Flapjax a behavior is also discrete by nature, as it is completely push driven. Does that make sense?

From: Leo Meyerovich
Sent: ‎9/‎09/‎2015 17:30
To: fla...@googlegroups.com
Subject: Re: [Flapjax: 850] Forking Typescript to make a strongly-typedFlapjax compiler?

You received this message because you are subscribed to a topic in the Google Groups "Flapjax" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/flapjax/XtYDQbU7Ht8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to flapjax+u...@googlegroups.com.

Leo Meyerovich

unread,
Sep 9, 2015, 12:04:11 PM9/9/15
to fla...@googlegroups.com

Flapjax behaviors are basically 'a * Event 'a, and most operators will coerce to Event 'a as needed (but not the other way around, as that is less sensibly defined). Due to the chaining sugar, it probably makes more sense to model as classes Behavior <: Event.

An issue I believe Arjun worked on in his thesis work is how all the helper methods got added to the ~class. He invented new types to describe ~metaprogramming here, but also rewrote code to make the job easier.

Reply all
Reply to author
Forward
0 new messages