# runtime errors

Published articles for runtime errors.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Transitioning from C and C++ to Rust: A Beginner's Guide

DevFeed: [Transitioning from C and C++ to Rust: A Beginner's Guide](<https://devfeed.tech/articles/transitioning-from-c-and-c-to-rust-a-beginner-s-guide-22268.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2024/10/transitioning-from-c-and-c++-to-rust.html>)

Published: 2024-10-29T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Rust](<https://devfeed.tech/topics/rust.md>), [C](<https://devfeed.tech/topics/c.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [beginner](<https://devfeed.tech/tags/beginner.md>), [c](<https://devfeed.tech/tags/c.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [c-plus-plus-to-rust](<https://devfeed.tech/tags/c-plus-plus-to-rust.md>), [c-to-rust](<https://devfeed.tech/tags/c-to-rust.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [enums](<https://devfeed.tech/tags/enums.md>), [generics](<https://devfeed.tech/tags/generics.md>), [guide](<https://devfeed.tech/tags/guide.md>), [memory-management](<https://devfeed.tech/tags/memory-management.md>), [memory-safety](<https://devfeed.tech/tags/memory-safety.md>), [migrating-from-c-plus-plus-to-rust](<https://devfeed.tech/tags/migrating-from-c-plus-plus-to-rust.md>), [pattern-matching](<https://devfeed.tech/tags/pattern-matching.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [runtime-errors](<https://devfeed.tech/tags/runtime-errors.md>), [rust](<https://devfeed.tech/tags/rust.md>), [rust-for-c-developers](<https://devfeed.tech/tags/rust-for-c-developers.md>), [rust-for-c-plus-plus-programmers](<https://devfeed.tech/tags/rust-for-c-plus-plus-programmers.md>), [rust-programming](<https://devfeed.tech/tags/rust-programming.md>), [transitioning-from-c-and-c-plus-plus-to-rust-guide](<https://devfeed.tech/tags/transitioning-from-c-and-c-plus-plus-to-rust-guide.md>), [transitioning-from-c-and-c-plus-plus-to-rust-tutorial](<https://devfeed.tech/tags/transitioning-from-c-and-c-plus-plus-to-rust-tutorial.md>), [transitioning-to-rust](<https://devfeed.tech/tags/transitioning-to-rust.md>), [types](<https://devfeed.tech/tags/types.md>)

### AI overview

A beginner's guide to transitioning from C and C++ to Rust, focusing on Rust's ownership and borrowing model, compile-time memory-safety checks, and type-system features such as enums, pattern matching, and generics.

### Source excerpt

Introduction: As you embark on the journey from C or C++ to Rust, you'll discover a world of exciting possibilities. Rust's emphasis on safety, concurrency, and performance can significantly enhance your programming toolkit. This beginner's guide on transitioning from C and C++ to Rust will provide a structured approach to making that transition, addressing essential concepts and practical applications. Let's dive in! Step 1: Understanding Rust's Ownership Model Concept Overview: Rust's ownership model is its most distinctive feature. Unlike C and C++, where you have pointers and manual memory management, Rust uses a system of ownership with rules that the compiler checks at compile time.

## Parsing: the merit of strictly typed JSON

DevFeed: [Parsing: the merit of strictly typed JSON](<https://devfeed.tech/articles/parsing-the-merit-of-strictly-typed-json-19972.md>)

Original publisher: [Read original article](<https://www.theguardian.com/info/article/2024/jul/26/parsing-the-merit-of-strictly-typed-json>)

Author: Max Duval

Published: 2024-07-26T16:05:58Z

Content type: tutorial

Language: en

Sources: [Guardian](<https://devfeed.tech/sources/guardian.md>)

Topics: [JSON](<https://devfeed.tech/topics/json.md>), [TypeScript](<https://devfeed.tech/topics/typescript.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Parsing](<https://devfeed.tech/topics/parsing.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [javascript](<https://devfeed.tech/tags/javascript.md>), [json](<https://devfeed.tech/tags/json.md>), [parsing](<https://devfeed.tech/tags/parsing.md>), [rest-apis](<https://devfeed.tech/tags/rest-apis.md>), [runtime-errors](<https://devfeed.tech/tags/runtime-errors.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

### AI overview

This tutorial explains how loosely typed JSON.parse results can undermine TypeScript's static analysis. It recommends precisely describing and validating the shape of changing JSON responses so API or data-shape errors can be detected and handled more helpfully before they cause runtime failures.

### Source excerpt

Dealing with content that keeps changing can lead to bugs on users' devices that are hard to reproduce. By precisely describing the shape of the content using types and ensuring it matches, exceptions can be avoided and users shown helpful messages when errors occur. This post will illustrate how this can be achieved with standard web technologies. The programming language of the web is JavaScript (JS), but its lack of static typing is the top pain point raised from the 2023 State of JS survey. We rely on TypeScript (TS) to get a strong structural type analysis of our code, as mentioned in our article on standardisation. Static typing helps prevent runtime errors on our users' machines. However, to ensure that no TypeError ever appears, we need to avoid the loose 'any' type, which is an escape hatch designed to opt-out of TS' static analysis. JavaScript Object Notation (JSON) is widely used as a data exchange format for REST APIs. Its syntax is compatible with JS, with only a subset of the language's primitives: objects, arrays, strings, numbers and nulls. Simple objects can be turned into a string with JSON.stringify and turned back into an object with JSON.parse, making it an adequate choice for many uses. We use it for powering our comments, new live blog updates, football match scores, weather, most read and other features of the website and Apps. Continue reading...

## Handling Runtime Exceptions

DevFeed: [Handling Runtime Exceptions](<https://devfeed.tech/articles/handling-runtime-exceptions-25055.md>)

Original publisher: [Read original article](<https://typealias.com/start/kotlin-exceptions/>)

Author: author@typealias.com (Dave Leeds)

Published: 2024-02-28T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

Topics: [Exception](<https://devfeed.tech/topics/exception.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [custom-exceptions](<https://devfeed.tech/tags/custom-exceptions.md>), [exception](<https://devfeed.tech/tags/exception.md>), [exception-handling](<https://devfeed.tech/tags/exception-handling.md>), [exception-types-in-kotlin](<https://devfeed.tech/tags/exception-types-in-kotlin.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-programming](<https://devfeed.tech/tags/kotlin-programming.md>), [kotlin-throw-keyword](<https://devfeed.tech/tags/kotlin-throw-keyword.md>), [learn-to-program](<https://devfeed.tech/tags/learn-to-program.md>), [programming](<https://devfeed.tech/tags/programming.md>), [runtime-errors](<https://devfeed.tech/tags/runtime-errors.md>), [try-catch-blocks](<https://devfeed.tech/tags/try-catch-blocks.md>)

### AI overview

This Kotlin tutorial explains runtime exceptions, contrasting runtime problems with compile-time errors and introducing how to handle unexpected problems while a program runs.

### Source excerpt

In real life, when we decide to do something, we primarily think in terms of a successful experience. For example, if you're driving to your friend's house for dinner, you might look up the directions on a mapping app, make sure you've got enough gasoline in the car, and leave at the right time in order to arrive when dinner is hot. If everything goes according to plan, you'll arrive on time.

## Limitations of Generic Variance Modifiers in Java and Kotlin

DevFeed: [Limitations of Generic Variance Modifiers in Java and Kotlin](<https://devfeed.tech/articles/variance-modifiers-limitations-39219.md>)

Original publisher: [Read original article](<https://kt.academy/article/ak-variance-limitations>)

Published: 2023-02-20T00:15:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [Generic Variance](<https://devfeed.tech/topics/generic-variance.md>), [Covariance](<https://devfeed.tech/topics/covariance.md>), [Contravariance](<https://devfeed.tech/topics/contravariance.md>), [Type Parameter](<https://devfeed.tech/topics/type-parameter.md>), [Java](<https://devfeed.tech/topics/java.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>)

Tags: [contravariance](<https://devfeed.tech/tags/contravariance.md>), [covariance](<https://devfeed.tech/tags/covariance.md>), [generic-variance](<https://devfeed.tech/tags/generic-variance.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [runtime-errors](<https://devfeed.tech/tags/runtime-errors.md>), [type-parameter](<https://devfeed.tech/tags/type-parameter.md>), [variance](<https://devfeed.tech/tags/variance.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This tutorial explains how covariance and contravariance affect generic types in Java and Kotlin. It uses Java's covariant arrays to illustrate runtime type errors and describes why Kotlin restricts variance in public in-positions while allowing safe producer and read-only patterns.

### Source excerpt

What limitations generic variance modifiers introduce, and how can we ignore them.

## Exhaustiveness Checking with Mypy

DevFeed: [Exhaustiveness Checking with Mypy](<https://devfeed.tech/articles/exhaustiveness-checking-with-mypy-33932.md>)

Original publisher: [Read original article](<https://hakibenita.com/python-mypy-exhaustive-checking>)

Author: Haki Benita

Published: 2020-12-07T22:00:00Z

Content type: tutorial

Language: en

Sources: [Haki Benita](<https://devfeed.tech/sources/haki-benita.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [enum](<https://devfeed.tech/topics/enum.md>), [ci](<https://devfeed.tech/topics/ci.md>), [Exception](<https://devfeed.tech/topics/exception.md>), [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [articles](<https://devfeed.tech/tags/articles.md>), [ci](<https://devfeed.tech/tags/ci.md>), [django](<https://devfeed.tech/tags/django.md>), [enum](<https://devfeed.tech/tags/enum.md>), [exception](<https://devfeed.tech/tags/exception.md>), [python](<https://devfeed.tech/tags/python.md>), [runtime-errors](<https://devfeed.tech/tags/runtime-errors.md>), [vscode](<https://devfeed.tech/tags/vscode.md>)

### AI overview

This tutorial explains how to use mypy, an optional static type checker for Python, to detect unhandled values in enumerations before runtime. It presents a helper function that enables exhaustiveness checking, shows the resulting warning, and describes integrating mypy into CI.

### Source excerpt

What if mypy could warn you about possible problems at "compile time"? In this article I share a little trick to get mypy to fail when a value in an enumeration type is left unhandled.

## Red/System: New Features

DevFeed: [Red/System: New Features](<https://devfeed.tech/articles/red-system-new-features-22378.md>)

Original publisher: [Read original article](<https://www.red-lang.org/2020/08/redsystem-new-features.html>)

Author: Nenad Rakocevic (noreply@blogger.com)

Published: 2020-08-20T10:54:00Z

Content type: release

Language: en

Sources: [Red](<https://devfeed.tech/sources/red.md>)

Topics: [Red](<https://devfeed.tech/topics/red.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [arrays](<https://devfeed.tech/tags/arrays.md>), [atomic](<https://devfeed.tech/tags/atomic.md>), [bugfixes](<https://devfeed.tech/tags/bugfixes.md>), [compilation](<https://devfeed.tech/tags/compilation.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [features](<https://devfeed.tech/tags/features.md>), [floating-point](<https://devfeed.tech/tags/floating-point.md>), [fpu](<https://devfeed.tech/tags/fpu.md>), [ia-32](<https://devfeed.tech/tags/ia-32.md>), [literal-arrays](<https://devfeed.tech/tags/literal-arrays.md>), [math](<https://devfeed.tech/tags/math.md>), [new-features](<https://devfeed.tech/tags/new-features.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [red-system](<https://devfeed.tech/tags/red-system.md>), [runtime-errors](<https://devfeed.tech/tags/runtime-errors.md>), [vfp](<https://devfeed.tech/tags/vfp.md>)

### AI overview

An overview of recent Red/System features, including subroutines, atomic and stack intrinsics, FPU status access, and changes to literal arrays.

### Source excerpt

In the past months, many new features were added to Red/System, the low-level dialect embedded in Red. Here is a sum up if you missed them. Subroutines During the work on the low-level parts of the new Red lexer, the need arised for intra-function factorization abilities to keep the lexer code as DRY as possible. Subroutines were introduced to solve that. They act as the GOSUB directive from Basic language. They are defined as a separate block of code inside a function's body and are called like regular functions (but without any arguments). So they are much lighter and faster than real function calls and require just one slot of stack space to store the return address. The declaration syntax is straightforward: <name>: [<body>] <name> : subroutine's name (local variable). <body> : subroutine's code (regular R/S code). To define a subroutine, you need to declare a local variable with the subroutine! datatype, then set that variable to a block of code. You can then invoke the subroutine by calling its name from anywhere in the function body (but after the subroutine own definition). Here is a first example of a fictive function processing I/O events: process: func [buf [byte-ptr!] event [integer!] return: [integer!] /local log do-error [subroutine!] ][ log: [print-line [">>" tab e "<<"]] do-error: [print-line ["** Error:" e] return 1] switch event [ EVT_OPEN [e: "OPEN" log unless connect buf [do-error]] EVT_READ [e: "READ" log unless receive buf [do-error]] EVT_WRITE [e: "WRITE" log unless send buf [do-error]] EVT_CLOSE [e: "CLOSE" log unless close buf [do-error]] default [e: "<unknown>" do-error] ] 0 ] This second example is more complete. It shows how subroutines can be combined and how values can be returned from a subroutine: #enum modes! [ CONV_UPPER CONV_LOWER CONV_INVERT ] convert: func [mode [modes!] text [c-string!] return: [c-string!] /local lower? upper? alpha? do-conv [subroutine!] delta [integer!] s [c-string!] c [byte!] ][ lower?: [all [#"a" <= c c <= #