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

9
Dmitri Nesteruk @dnesteruk

Upload: spbdotnet-community

Post on 12-Feb-2017

84 views

Category:

Software


1 download

TRANSCRIPT

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

Dmitri Nesteruk@dnesteruk

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

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.

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

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

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

Domain-Specific Languages (DSLs)Mathematics/algorithms

Quant financeProbabilistic modelsData science, AI, etc…

Symbolic processingParsing/lexingSymbolic differentiationCircuit verification

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

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

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

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

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

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

Fslexx/fsyaccProject template online

Most power gained fromDiscriminated unionsPattern matching

Active patternsList comprehensions

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

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

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

Questions?@[email protected]