Cover by Chris Smith

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

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 ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required