Дмитрий Нестерук «f#: Опыт и Перспективы»

Post on 12-Feb-2017

84 Views

Category:

Software

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Dmitri Nesteruk@dnesteruk

Tool supportVS support very thinNo code analysis tools

And VS itself is slow

Profiling, unit testingMarket penetration

Thin but we don’t know how thinCurrently (Sept 2016) 29th on TIOBE

Are functional aspects worth it?Next slide

Perceived lack of evolutionOpen sourced ergo uncertain future

This dog is skeptical.

First class functionsC# has this

Higher order functionsC# has this, e.g., LINQ etc.

Pure functionsRecursion

No tail recursion in C#, see JITType inferencePurely functional data structures

Of dubious valueImmutability

Function ‘magic’Currying/partial applicationFunctional composition >>Pipelining <| |>

Not really functional stuffWorkflows (~ monads)ADTsTuplesPattern matching118 operators

C# will eventually steal everything worth stealing

Domain-Specific Languages (DSLs)Mathematics/algorithms

Quant financeProbabilistic modelsData science, AI, etc…

Symbolic processingParsing/lexingSymbolic differentiationCircuit verification

Top-level declarationsNo need to ‘nest’ in namespace+classNo need for main() entrypoint

(Curried) function calls without braces/commasdoFoo a b c

No need for explicit declarations (var/let)Can have global-appearing state

Result: you end up writing EnglishMutability may result in (somewhat) ugly code

Math in print is (typically) immutableType inference means less typing

But can lead to real annoyances2.0 * sign x // invalid!

Lowercase functions with no namespace prefixNo braces in function callssin x

Conditional logic is better

Continuous compilation (REPL)It’s all about libs & tools

VS parses F# with F#http://fsharppowerpack.codeplex.com

Fslexx/fsyaccProject template online

Most power gained fromDiscriminated unionsPattern matching

Active patternsList comprehensions

Niche language for specific domainsOkay for math but needs libs

Most good libs are C++, but many have .NET wrappersGood for algorithmic/back-end tasksUseful for DSLsGood for quickly defining simple data structuresNot good for

Full OOPHighly mutable constructsUI

Questions?@dnesterukdmitrinesteruk@gmail.com

top related