Skip to Main Content
Emerging Programming Languages
book

Emerging Programming Languages

by O'Reilly Editorial Team
June 2019
Intermediate to advanced content levelIntermediate to advanced
35 pages
42m
English
O'Reilly Media, Inc.
Content preview from Emerging Programming Languages

Chapter 4. Language Summaries

The rest of this report examines the purpose of each language and how some of its features reflect that purpose.

Crystal

Although the proponents of many languages claim good performance, developers who make speed of execution a high priority still fall back on C or one of its derivatives. Crystal is the latest attempt to achieve both performance and the highly structured, compact code permitted by Ruby. Thus, Crystal is procedural and object oriented. It allows for both explicit typing and type inference, like many scripting languages, offering the fool-proof typing of traditional compiled languages and the simplicity of classic scripting languages.

The resemblance to Ruby can be seen in such syntax features as the do loops in the following calls to a database. The activities in this snippet will be familiar to anyone who has accessed a database from a programming language using something like the Open Database Connectivity standard:

DB.open "sqlite3://./data.db" do |db|                 1
  db.exec "CREATE TABLE contacts (name VARCHAR(30), age INT)"
  db.exec "INSERT INTO contacts VALUES (?, ?)", "Frank", 30
  db.exec "INSERT INTO contacts VALUES (?, ?)", "Alexa", 33

  db.query "SELECT name, age FROM contacts" do |rows| 2 rows.each do name, age = rows.read(String, Int32) person ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition

Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition

Matthew Helmke, Andrew Hudson, Paul Hudson
Helping Kids with Coding For Dummies

Helping Kids with Coding For Dummies

Camille McCue Ph.D, Guthals

Publisher Resources

ISBN: 9781492082590