Chapter 10. Scripting

In previous chapters, you saw how F# can be effective across multiple
programming paradigms. But F# is not only well suited for different
styles of programming, it can also be effective for
writing different types of programs as well. F# is not
only useful for client applications, but can also be effective as a
scripting language too.

Scripting is general term used to describe programs that don’t have a UI and are
focused on solving a particular task. In most scripting languages, the
script consists entirely of code—as opposed to an executable program—that is
then interpreted by a runtime engine.

Programming in this mode typically sacrifices execution speed for the
convenience of being able to easily modify and deploy the program. Rather
than creating a complex solution designed to work everywhere, you can simply
move a script from machine to machine and modify it as necessary.

Although F# may be best suited for client application programming,
using it in a scripting context has one major advantage: you already know
it. Rather than learning a separate language for your scripts, employing F#
for your scripting needs lets you reuse your existing code and knowledge
about F# programming. Also, F# code is never interpreted—it is always
compiled first. So F# can be comparatively faster than pure scripting
languages.

If you have a simple problem and don’t need a complicated interface, consider scripting the solution. In this chapter, you learn about some constructs available ...

The best content for your career. Discover unlimited learning
on demand for around $1/day.