Читать книгу Beginning Programming All-in-One For Dummies - Wallace Wang - Страница 68

THE PROS AND CONS OF TYPE-SAFE LANGUAGES

Оглавление

So, why isn’t every programming language type-safe? Good question. Here are two reasons:

 Creating a type-safe language means more work to create a compiler that can examine an entire program and check to make sure data types (such as numbers and text) aren't getting changed around unexpectedly. This translates into a slower and more complicated compiler, which is more work for the programmers who have to create the compiler in the first place.

 Type-safe languages can be restrictive, like trying to ride a motorcycle in a padded suit. The padded suit may protect you, but it also restricts your movement. Similarly, by not checking that data types remain consistent throughout a program, other languages give the programmer more freedom.Use this freedom wisely and you can create programs without the nuisance of type-safe checking, which can feel like having your parents staring over your shoulder every time you browse the Internet. Use this freedom poorly, and you’ll wind up writing a program that crashes the computer.

Although non-type-safe languages are popular, the growing trend is to use type-safe languages that protect the programmer from writing programs that can mess up its data and crash the entire computer. C#, Java, and other languages, such as Swift, are considered type-safe languages.

Beginning Programming All-in-One For Dummies

Подняться наверх