funscript: why bother?

Post on 01-Dec-2014

756 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

FunScript is an F# to JavaScript compiler but, why bother with yet another *** to JS compiler? Give me five minutes and I'll try to convince you.

TRANSCRIPT

FunScript F# to JavaScript with type providers

What is FunScript?

FunScript F# to JavaScript with type providers

FunScript is...

yet another JavaScript compiler

So why bother?

FunScript F# to JavaScript with type providers

It seems as if every programming languagein the world compiles now to JavaScript And many of them are functional

o Elmo LiveScripto PureScripto Fay

So, why bother with FunScript?Reason #1...

FunScript F# to JavaScript with type providers

THERE’S A F#erWITHIN YOU

AND YOU KNOW IT

FunScript F# to JavaScript with type providers

F# is a mature, open source, cross-platform,functional-first programming language. F# runs on Linux, Mac OS X, Android, iOS,Windows as well as HTML 5 and GPUs. But enough of sales pitch!

Free as in beer!

And we all know when sth wants to conquerthe whole world is always a good thing

but also multi-paradigm

FunScript F# to JavaScript with type providers

SHOW ME DA GOODIES

FunScript F# to JavaScript with type providers

Write F# client-side code in powerful IDEswith autocomplete and tooltips

Intellisense is addictive!

No plugin required!

FunScript F# to JavaScript with type providers

F# compiler is your best friendIt helps you write better code by pointing out your mistakes

If it were a human I would kill it ...but it’s not!

FunScript F# to JavaScript with type providers

Usual functional stuff• First-class and higher-order functions• Immutability• Recursion• Pattern matching• Type inference

Type safety

without the h

assle

FunScript F# to JavaScript with type providers

Functional data structures• Tuples• Records• Discriminated Unions (Option built-in)• Classes and Modules• Functional collectionso Recursive listso Mapo Seto seq

Never type

IEnumerable

again!

FunScript F# to JavaScript with type providers

.NET mutable collections• Array• ResizeArray (mutable List)• Dictionary

They’ll compile as JS arrays and POJ

Os,

so they’re compatible with browser code

FunScript F# to JavaScript with type providers

FunScript is compatible with many methodsof most used .NET classes • Regular Expressions• DateTime / TimeSpan• String Formatting• WebRequest

Am I the only one with trouble

to remember how to use Regex

and Dates in each platform?

FunScript F# to JavaScript with type providers

.NET Regular Expressions usage example

FunScript F# to JavaScript with type providers

F# unique featureso Type providers!o Units of measureo Computation expressions

Click here fora wonderful talk

FunScript F# to JavaScript with type providers

And with FunScript.HTML extensionsyou can create HTML 5 web apps

using your F#/.NET skills

Like...

FunScript F# to JavaScript with type providers

Functional Reactive Programming (1)

Every element hasan equivalent extensionproperty to generatean IObservable

FunScript F# to JavaScript with type providers

Functional Reactive Programming (2)

Internal state

FunScript F# to JavaScript with type providers

Functional Reactive Programming (and 3)

String formatting

DateTime

These extension methodscan easily be implementedfor other platforms

FunScript F# to JavaScript with type providers

Asynchronous workflows (1)Share types with LINQ to SQL, Web API and client code

LINQ, Web API and

FunScript do the tedious

marshaling work for you

FunScript F# to JavaScript with type providers

Asynchronous workflows (2)

Asynchronous workflows are also very goodto handle events as you can use them

to represent a state-machine

Forget about “Inversion of Control”Take the program flow control back!

FunScript F# to JavaScript with type providers

Asynchronous workflows (and 3)

No flags needed!

FunScript F# to JavaScript with type providers

Some people

still likeJS eventhandlingthough

FunScript F# to JavaScript with type providers

So FunScript and FunScript.HTMLextensions allow you to:

o Minimize errorso Reuse code

o Reuse your skillsAnd most importantly...

FunScript F# to JavaScript with type providers

There are wonderful JS libraries out thereDo I have to renounce to use them?

This is great. But...

Nope!FunScript offers wrappers for all definitionsin the TypeScript repository through NuGet

FunScript F# to JavaScript with type providers

FunScript F# to JavaScript with type providers

FunScript.HTML also offers deeperintegration with a great JavaScript

MVC framework:

Ractive.jsCheck its wonderful websiteto know more

FunScript F# to JavaScript with type providers

Encapsulate stateAsync f

or events

and state upd

ates

FunScript F# to JavaScript with type providers

If necessary, you can extend FunScriptyourself easily

FunScript F# to JavaScript with type providers

To be fair, there is also another F#to JavaScript compiler out there:

WebSharper, a fantastic projectby IntelliFactory

Unlike FunScript, WebSharper is afull-fledged web framework

A more detailed comparison follows.

FunScript F# to JavaScript with type providers

Oh, c’mon!

FUNSCRIPTFEATURES

Everythingyou just saw

WEBSHARPERFEATURES

Sorry, I haven’tused it. Pleasevisit their site

and judge yourself

FunScript F# to JavaScript with type providers

This is coming to an end

SAYONARABABY

That’s what he said in the Spanish version

FunScript F# to JavaScript with type providers

FunScript has been created by Zach Brayand several bright minds from theF# community have contributed to it

▪Tomas Petricek▪Robert Pickering▪James Freiwirth

...more at funscript.info

Doesn’t it sou

nd

like a Marvel

Hero name?

FunScript F# to JavaScript with type providers

And this presentation has beenassembled by yours truly,

Alfonso García-Caro

@alfonsogcnunezgithub.com/alfonsogarciacaro

So now...

I’m also acollaboratornow, but I’mmore of afreeloader

FunScript F# to JavaScript with type providers

WHAT THEHELL ARE YOUWAITING FOR

top related