# enum

An enum is a programming construct that defines a type from a set of named or symbolic members, which can represent distinct choices or variants.

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

## Unenumerbrated

DevFeed: [Unenumerbrated](<https://devfeed.tech/articles/unenumerbrated-136390.md>)

Original publisher: [Read original article](<https://thedailywtf.com/articles/unenumerbrated>)

Author: Ellis Morning

Published: 2026-11-16T06:30:00Z

Content type: article

Language: en

Sources: [The Daily WTF](<https://devfeed.tech/sources/the-daily-wtf.md>)

Topics: [enum](<https://devfeed.tech/topics/enum.md>), [data type](<https://devfeed.tech/topics/data-type.md>)

Tags: [client](<https://devfeed.tech/tags/client.md>), [count](<https://devfeed.tech/tags/count.md>), [database](<https://devfeed.tech/tags/database.md>), [enum](<https://devfeed.tech/tags/enum.md>), [feature-articles](<https://devfeed.tech/tags/feature-articles.md>), [has](<https://devfeed.tech/tags/has.md>), [index](<https://devfeed.tech/tags/index.md>), [mysql](<https://devfeed.tech/tags/mysql.md>), [payments](<https://devfeed.tech/tags/payments.md>), [queries](<https://devfeed.tech/tags/queries.md>), [string](<https://devfeed.tech/tags/string.md>)

### AI overview

A MySQL column defined as `enum('0', '1')` caused confusing query results because enum values are strings, while unquoted integer comparisons can refer to their 1-based enum indices. Thus `successful='1'` compares with the string value, whereas `successful=1` compares with the first enum index, `'0'`. The author recommends using descriptive enum labels such as `successful` and `unsuccessful` instead of numeric-looking labels. The excerpt also notes that some ORM or query-builder frameworks quote values and rely on MySQL's conversions, adding to the confusion.

### Source excerpt

Submitter Valts shares an enumerated mystery: This happened a few years ago (before COVID). A colleague called me over because he couldn't make sense of the results he was getting from some MySQL queries in MySQL Workbench. I don't remember the queries in particular, but let's say select * from payments where client_id=1234 showed 12 rows, all having the successful field set to 1. But when you selected select count(*) from payments where client_id=1234 and successful=1 you got back 0 rows. And this was reproducible on my machine, too. Yet in code similar queries worked just fine. After a lot of head-scratching and increasingly bizarre hypotheses, we finally figured out what was going on. In the far, far past, in dark days gone by, someone had defined the database field as enum('0', '1'). This SEEMS pretty rational ... until you start reading up how MySQL treats enums. Enums, it turns out, are all STRING values. But in queries you can use either their string values, or their integer indices, starting at 1. So in this case, the string "0" has the integer index of "1", and the string "1" has the integer index of "2". So select * from payments where successful='1' is quite different from select * from payments where successful=1. For extra confusion, under most other circumstances MySQL normally silently converts between strings and integers as needed. Some ORM/QueryBuilder frameworks even simply quote ALL values and let MySQL handle the conversions. Facepalms were had. In the aftermath, I blame the person who defined this field more than I blame MySQL for its bizzare enum conventions. If you're doing enums (which are generally a good thing), then give them proper names like successful and unsuccessful or something. Not 0 and 1. This code and this database table is still in use today, but luckily it's the only such gotcha in the entire system. Enums in the database are scarce and the rest of them are sane. [Advertisement] Keep all your packages and Docker containers in

## Mercure Broadcasting in Laravel 13.32

DevFeed: [Mercure Broadcasting in Laravel 13.32](<https://devfeed.tech/articles/mercure-broadcasting-in-laravel-13-32-31558.md>)

Original publisher: [Read original article](<https://laravel-news.com/laravel-13-32-0>)

Author: Paul Redmond

Published: 2026-09-16T02:44:52Z

Content type: release

Language: en

Sources: [Laravel](<https://devfeed.tech/sources/laravel.md>)

Topics: [Laravel](<https://devfeed.tech/topics/laravel.md>), [releases](<https://devfeed.tech/topics/releases.md>), [Release notes](<https://devfeed.tech/topics/release-notes.md>), [real-time](<https://devfeed.tech/topics/real-time.md>), [enum](<https://devfeed.tech/topics/enum.md>), [WebSocket](<https://devfeed.tech/topics/websocket.md>)

Tags: [enums](<https://devfeed.tech/tags/enums.md>), [features](<https://devfeed.tech/tags/features.md>), [github](<https://devfeed.tech/tags/github.md>), [laravel](<https://devfeed.tech/tags/laravel.md>), [laravel-releases](<https://devfeed.tech/tags/laravel-releases.md>), [news](<https://devfeed.tech/tags/news.md>), [queue](<https://devfeed.tech/tags/queue.md>), [real-time](<https://devfeed.tech/tags/real-time.md>), [release](<https://devfeed.tech/tags/release.md>), [release-notes](<https://devfeed.tech/tags/release-notes.md>), [storage](<https://devfeed.tech/tags/storage.md>), [update](<https://devfeed.tech/tags/update.md>), [websockets](<https://devfeed.tech/tags/websockets.md>)

### AI overview

Laravel 13.32 adds a Mercure broadcast driver, filesystem methods for copying and moving files between disks, and enum support for queue pause and resume methods. The release also includes additional fixes and updates.

### Source excerpt

Laravel 13.32 adds a Mercure broadcast driver, Storage::copyToDisk() and moveToDisk(), enum support in queue pause/resume, and more. The post Mercure Broadcasting in Laravel 13.32 appeared first on Laravel News. Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.

## Debezium 3.6 Release Summary

DevFeed: [Debezium 3.6 Release Summary](<https://devfeed.tech/articles/debezium-3-6-release-summary-47516.md>)

Original publisher: [Read original article](<https://debezium.io/blog/2026/07/01/debezium-3-6-final-release/>)

Author: Chris Cranford

Published: 2026-07-01T00:00:00Z

Content type: release

Language: en

Sources: [Debezium](<https://devfeed.tech/sources/debezium-io.md>)

Topics: [releases](<https://devfeed.tech/topics/releases.md>), [MongoDB](<https://devfeed.tech/topics/mongodb.md>), [MariaDB](<https://devfeed.tech/topics/mariadb.md>), [MySQL](<https://devfeed.tech/topics/mysql.md>), [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [deprecated](<https://devfeed.tech/topics/deprecated.md>), [enum](<https://devfeed.tech/topics/enum.md>)

Tags: [bug-fixes](<https://devfeed.tech/tags/bug-fixes.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [deprecated](<https://devfeed.tech/tags/deprecated.md>), [enum](<https://devfeed.tech/tags/enum.md>), [general-availability](<https://devfeed.tech/tags/general-availability.md>), [improvements](<https://devfeed.tech/tags/improvements.md>), [mariadb](<https://devfeed.tech/tags/mariadb.md>), [mongodb](<https://devfeed.tech/tags/mongodb.md>), [mysql](<https://devfeed.tech/tags/mysql.md>), [new-features](<https://devfeed.tech/tags/new-features.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [release](<https://devfeed.tech/tags/release.md>), [release-summary](<https://devfeed.tech/tags/release-summary.md>)

### AI overview

Debezium 3.6 is generally available with new features, improvements, bug fixes, and breaking changes across its connectors. The release changes MongoDB schema-name handling, removes the NEVER snapshot mode for MySQL and MariaDB, deprecates an Oracle mining strategy, and returns PostgreSQL enum values in logical sort order.

### Source excerpt

We're thrilled to announce the general availability of Debezium 3.6, the latest major milestone in the Debezium 3.x series. Over the course of six preview and candidate releases -- Alpha1, Alpha2, Beta1, Beta2, CR1, and Final -- Debezium 3.6 delivers a sweeping set of new features, improvements, and bug fixes across the entire ecosystem. Read on for the full details of everything that shipped in Debezium 3.6! Read more...

## Splitting the NetEscapades.EnumGenerators packages: the road to a stable release

DevFeed: [Splitting the NetEscapades.EnumGenerators packages: the road to a stable release](<https://devfeed.tech/articles/splitting-the-netescapades-enumgenerators-packages-the-road-to-a-stable-release-51487.md>)

Original publisher: [Read original article](<https://andrewlock.net/splitting-the-netescapades-enumgenerators-packages-the-road-to-a-stable-release/>)

Author: Andrew Lock

Published: 2026-03-10T09:00:00Z

Content type: article

Language: en

Sources: [Andrew Lock | .NET Escapades](<https://devfeed.tech/sources/andrew-lock-net-escapades.md>)

Topics: [source generators](<https://devfeed.tech/topics/source-generators.md>), [.NET](<https://devfeed.tech/topics/net.md>), [enum](<https://devfeed.tech/topics/enum.md>), [.NET Framework](<https://devfeed.tech/topics/net-framework.md>)

Tags: [changes](<https://devfeed.tech/tags/changes.md>), [net](<https://devfeed.tech/tags/net.md>), [net-core](<https://devfeed.tech/tags/net-core.md>), [net-core-roslyn-source-generators](<https://devfeed.tech/tags/net-core-roslyn-source-generators.md>), [packages](<https://devfeed.tech/tags/packages.md>), [performance](<https://devfeed.tech/tags/performance.md>), [release](<https://devfeed.tech/tags/release.md>), [roslyn](<https://devfeed.tech/tags/roslyn.md>), [source-generators](<https://devfeed.tech/tags/source-generators.md>)

### AI overview

This post explains the restructuring of the NetEscapades.EnumGenerators source generator NuGet package into three packages ahead of a stable release. It also describes how the generator creates fast enum-handling implementations and compares their performance with built-in approaches across .NET versions.

### Source excerpt

In this post I describe the recent architectural changes to the NetEscapades.EnumGenerators package, which is now a metapackage, to support more scenarios

## Recent updates to NetEscapades.EnumGenerators: new APIs and System.Memory support

DevFeed: [Recent updates to NetEscapades.EnumGenerators: new APIs and System.Memory support](<https://devfeed.tech/articles/recent-updates-to-netescapades-enumgenerators-new-apis-and-system-memory-support-51491.md>)

Original publisher: [Read original article](<https://andrewlock.net/updates-to-netescapaades-enumgenerators-new-apis-and-system-memory-support/>)

Author: Andrew Lock

Published: 2026-01-02T09:00:00Z

Content type: release

Language: en

Sources: [Andrew Lock | .NET Escapades](<https://devfeed.tech/sources/andrew-lock-net-escapades.md>)

Topics: [enum](<https://devfeed.tech/topics/enum.md>), [NuGet](<https://devfeed.tech/topics/nuget.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [version](<https://devfeed.tech/topics/version.md>)

Tags: [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [feature](<https://devfeed.tech/tags/feature.md>), [latest-release](<https://devfeed.tech/tags/latest-release.md>), [net-core](<https://devfeed.tech/tags/net-core.md>), [net-core-roslyn-source-generators](<https://devfeed.tech/tags/net-core-roslyn-source-generators.md>), [new-features](<https://devfeed.tech/tags/new-features.md>), [nuget](<https://devfeed.tech/tags/nuget.md>), [performance](<https://devfeed.tech/tags/performance.md>), [roslyn](<https://devfeed.tech/tags/roslyn.md>), [source-generators](<https://devfeed.tech/tags/source-generators.md>)

### AI overview

This post covers updates to the NetEscapades.EnumGenerators source generator in version 1.0.0-beta19, including System.Memory support, new APIs, and options for enum parsing and serialization. It also explains how generated implementations can improve enum operation performance.

### Source excerpt

In this post I describe some recent changes to the NetEscapades.EnumGenerators source generator, including support for the System.Memory package and new APIs

## Empowering Your Annotations with Fields

DevFeed: [Empowering Your Annotations with Fields](<https://devfeed.tech/articles/empowering-your-annotations-with-fields-30743.md>)

Original publisher: [Read original article](<http://blog.vanillajava.blog/2024/12/empowering-your-annotations-with-fields.html>)

Author: Peter Lawrey (noreply@blogger.com)

Published: 2024-12-21T22:13:00Z

Content type: tutorial

Language: en

Sources: [Vanilla Java](<https://devfeed.tech/sources/vanilla-java.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [Code](<https://devfeed.tech/topics/code.md>), [interface](<https://devfeed.tech/topics/interface.md>), [enum](<https://devfeed.tech/topics/enum.md>)

Tags: [class](<https://devfeed.tech/tags/class.md>), [code](<https://devfeed.tech/tags/code.md>), [enum](<https://devfeed.tech/tags/enum.md>), [info](<https://devfeed.tech/tags/info.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [java](<https://devfeed.tech/tags/java.md>), [java-language](<https://devfeed.tech/tags/java-language.md>), [opinion](<https://devfeed.tech/tags/opinion.md>)

### AI overview

This tutorial explains how Java annotations can contain nested classes, interfaces, enums, other annotations, static fields, and embedded logic. It discusses uses such as domain converters, framework lifecycle hooks, and syntactic sugar, while noting that excessive nesting can reduce readability.

### Source excerpt

Introduction Java's annotation system has come a long way since its introduction in Java 5. At first glance, annotations appear to be mere metadata markers on classes and methods. However, annotations can do much more than that. You can nest types within them, incorporate fields that reference helper classes, and even embed logic via static singletons. These capabilities provide a powerful mechanism for integrating domain-specific or framework-specific functionality right into your code, in ways that are both compact and self-documenting. Why Add Code to Annotations? The Java language specification usually treats annotations as static metadata describing a type, method, field, or parameter. However, you can leverage nested classes (including enums, interfaces, and even other annotations) to extend the functionality of a single annotation. This approach allows you to keep logic closely tied to the metadata, rather than scattering it across multiple classes. Common use cases include: Custom domain converters. For example, if you have a long that needs to be stored in an encoded format (e.g., Base85), you can supply a default converter directly within the annotation. Framework-specific lifecycle hooks. You can embed an interface for processing the annotation, enabling the framework to perform reflective lookups and apply behaviour at runtime. Syntactic sugar. Rather than writing @LongConversion(SomeConverter.class), you could write @ShortText, which internally references a known converter. Nesting Types in Java You can nest various kinds of types within your classes or annotations--these include interfaces, enums, classes, and even other annotations. Although nesting these types can feel unconventional, it is fully supported by the language. For example: public class A { public interface B { public enum C { ; public @interface D { public class E { // etc etc } } } } } While this example might look bizarre, it demonstrates the power and flexibility of Java's nesting rule

## TypeScript enums and falsy values

DevFeed: [TypeScript enums and falsy values](<https://devfeed.tech/articles/typescript-enums-and-falsy-values-52575.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/typescript-enums-0-values/>)

Published: 2024-11-17T00:00:00Z

Content type: article

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [TypeScript](<https://devfeed.tech/topics/typescript.md>), [enum](<https://devfeed.tech/topics/enum.md>), [union types](<https://devfeed.tech/topics/union-types.md>), [conditionals](<https://devfeed.tech/topics/conditionals.md>), [Null-Safety](<https://devfeed.tech/topics/null-safety.md>), [if statement](<https://devfeed.tech/topics/if-statement.md>)

Tags: [boolean](<https://devfeed.tech/tags/boolean.md>), [bug](<https://devfeed.tech/tags/bug.md>), [code](<https://devfeed.tech/tags/code.md>), [condition](<https://devfeed.tech/tags/condition.md>), [conditional](<https://devfeed.tech/tags/conditional.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enums](<https://devfeed.tech/tags/enums.md>), [function](<https://devfeed.tech/tags/function.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [members](<https://devfeed.tech/tags/members.md>), [null](<https://devfeed.tech/tags/null.md>), [number](<https://devfeed.tech/tags/number.md>), [return](<https://devfeed.tech/tags/return.md>), [status](<https://devfeed.tech/tags/status.md>), [string](<https://devfeed.tech/tags/string.md>), [typescript](<https://devfeed.tech/tags/typescript.md>), [value](<https://devfeed.tech/tags/value.md>), [values](<https://devfeed.tech/tags/values.md>)

### AI overview

A numeric TypeScript enum starts at 0 by default, and JavaScript treats 0 as falsy. When a function returns an enum value or null, `if (status)` therefore mistakes the first enum member for "not logged in." The text recommends checking `status !== null`, or assigning enum members nonzero numeric values or nonempty strings so truthiness checks do not reject a valid status. It also notes that the issue can pass TypeScript compilation and mentions the TypeScript ESLint `strict-boolean-expressions` rule as a possible aid.

### Source excerpt

I recently lost an evening to debugging a subtle issue which highlights a potential pitfall in the interaction between TypeScript enums and "falsy" values in JavaScript. Let's look at a scenario that illustrates this problem: Spot the Bug Consider the following code where a function returns either an enum value or null depending on whether a user is logged in: const enum Status { Inactive, Active, Pending, } function getUserStatus(user?: User): Status | null { if (!user) { // No user is logged in. return null } return user.status() } function checkUserStatus(user?: User): void { const status = getUserStatus(userId) if (status) { console.log('User has a valid status:', status) } else { console.log('The user is not logged in.') } } What's the Issue? JavaScript has a concept of truthy and falsy values. In conditional statements, values that are considered falsy are treated as false. The list of falsy values in JavaScript include: false 0 "" (empty string) null undefined NaN This means that if(0) {} is always false in JavaScript. Now we can look at the default values assigned to enum members in TypeScript. As the TypeScript documentation states, when initializing enum values, the default values are numeric and start from 0. These two enums are equivalent: const enum Status { Inactive = 0, Active = 1, Pending = 2, } const enum Status { Inactive, Active, Pending, } This means that if an enum member is assigned the value 0, it will behave like false in any condition where truthiness is evaluated rather than explicitly checking for the null value. Solving with explicit checks To avoid this bug, explicitly check for null instead of relying on truthy checks: function checkUserStatus(user?: User): void { const status = getUserStatus(user) if (status !== null) { console.log('User has a valid status:', status) } else { console.log('The user is not logged in.') } } Solving with explicit enum values Alternatively, because each number in JavaScript that is not 0 is considered truth

## The Boolean Trap

DevFeed: [The Boolean Trap](<https://devfeed.tech/articles/the-boolean-trap-39098.md>)

Original publisher: [Read original article](<https://read.engineerscodex.com/p/the-boolean-trap>)

Author: Engineer's Codex

Published: 2024-09-05T02:06:52Z

Content type: opinion

Language: en

Sources: [Engineer's Codex](<https://devfeed.tech/sources/engineer-s-codex.md>)

Topics: [enum](<https://devfeed.tech/topics/enum.md>), [Software Engineering](<https://devfeed.tech/topics/software-engineering.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [apis](<https://devfeed.tech/tags/apis.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enums](<https://devfeed.tech/tags/enums.md>), [function](<https://devfeed.tech/tags/function.md>)

### AI overview

This article explains the boolean trap: boolean parameters in functions and APIs can make code unclear and difficult to extend. It recommends using enums instead, even for binary choices, because enums improve readability, typing, maintainability, and extensibility.

### Source excerpt

Use enums instead

## Deprecation of enum field "detached" from the "get repositories associated with a code security configuration" endpoint

DevFeed: [Deprecation of enum field "detached" from the "get repositories associated with a code security configuration" endpoint](<https://devfeed.tech/articles/deprecation-of-enum-field-detached-from-the-get-repositories-associated-with-a-code-security-configuration-endpoint-73034.md>)

Original publisher: [Read original article](<https://github.blog/changelog/2024-07-25-deprecation-of-enum-field-detached-from-the-get-repositories-associated-with-a-code-security-configuration-endpoint>)

Author: Allison

Published: 2024-07-25T21:43:26Z

Content type: release

Language: en

Sources: [GitHub Changelog](<https://devfeed.tech/sources/github-changelog.md>)

Topics: [code security](<https://devfeed.tech/topics/code-security.md>), [enum](<https://devfeed.tech/topics/enum.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [change](<https://devfeed.tech/tags/change.md>), [changes](<https://devfeed.tech/tags/changes.md>), [code-security](<https://devfeed.tech/tags/code-security.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [deprecated](<https://devfeed.tech/tags/deprecated.md>), [deprecation](<https://devfeed.tech/tags/deprecation.md>), [ensures](<https://devfeed.tech/tags/ensures.md>), [enterprise](<https://devfeed.tech/tags/enterprise.md>), [enum](<https://devfeed.tech/tags/enum.md>), [organization](<https://devfeed.tech/tags/organization.md>), [repositories](<https://devfeed.tech/tags/repositories.md>), [repository](<https://devfeed.tech/tags/repository.md>), [security](<https://devfeed.tech/tags/security.md>), [settings](<https://devfeed.tech/tags/settings.md>), [status](<https://devfeed.tech/tags/status.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

The endpoint will remain, but its `detached` status will be deprecated and replaced with `removed`. A new `removed_by_enterprise` status will identify cases where enterprise setting changes remove an organization-level code security configuration from a repository. The change aligns API statuses with the UI status filters.

### Source excerpt

The enum field indicating a 'detached' status will be deprecated from the 'Get repositories associated with a code security configuration' endpoint. The endpoint itself will remain. We will replace the...

## Lint Revisit: Providing Alternatives 🧙♀

DevFeed: [Lint Revisit: Providing Alternatives 🧙♀](<https://devfeed.tech/articles/lint-revisit-providing-alternatives-26175.md>)

Original publisher: [Read original article](<https://zarah.dev/2024/07/24/lintfix-alternatives.html>)

Author: Zarah Dominguez

Published: 2024-07-24T00:00:00Z

Content type: tutorial

Language: en

Sources: [Zarah Dominguez](<https://devfeed.tech/sources/zarah-dominguez.md>)

Topics: [enum](<https://devfeed.tech/topics/enum.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [enum](<https://devfeed.tech/tags/enum.md>), [github](<https://devfeed.tech/tags/github.md>), [jira](<https://devfeed.tech/tags/jira.md>), [lint](<https://devfeed.tech/tags/lint.md>), [regex](<https://devfeed.tech/tags/regex.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [test](<https://devfeed.tech/tags/test.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

This tutorial shows how to extend a TODO Detector lint rule with project-specific ticket prefixes, regular-expression validation, autofix alternatives, and tests for those alternatives. It also discusses difficulty placing the caret precisely in the generated fix.

### Source excerpt

In my previous post, we updated our TODO Detector to be more flexible. It is also easily extensible so that if we want to include more parameters or perhaps add more checks, we can follow the existing pattern and modify it.

## Exhaustive branch checks with TypeScript

DevFeed: [Exhaustive branch checks with TypeScript](<https://devfeed.tech/articles/exhaustive-branch-checks-with-typescript-52577.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/typescript-exhaustive-branches/>)

Published: 2024-03-04T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [TypeScript](<https://devfeed.tech/topics/typescript.md>), [exhaustive matching](<https://devfeed.tech/topics/exhaustive-matching.md>), [union types](<https://devfeed.tech/topics/union-types.md>), [enum](<https://devfeed.tech/topics/enum.md>)

Tags: [argument](<https://devfeed.tech/tags/argument.md>), [branch](<https://devfeed.tech/tags/branch.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [enum](<https://devfeed.tech/tags/enum.md>), [error](<https://devfeed.tech/tags/error.md>), [exhaustive](<https://devfeed.tech/tags/exhaustive.md>), [function](<https://devfeed.tech/tags/function.md>), [parameter](<https://devfeed.tech/tags/parameter.md>), [switch](<https://devfeed.tech/tags/switch.md>), [type](<https://devfeed.tech/tags/type.md>), [typescript](<https://devfeed.tech/tags/typescript.md>), [union](<https://devfeed.tech/tags/union.md>)

### AI overview

When branching on a TypeScript union or enum, add a `default` branch that calls `ensureExhaustive(value)`, a helper accepting `never`. If the type later gains a value that the branches do not handle, TypeScript reports that the value is not assignable to `never` and identifies the missing variant. This can catch unhandled cases even in `void` functions, where a missing branch may otherwise produce no error. The excerpt says the same approach works with narrowed `if`/`else` branches. The helper throws at runtime if reached.

### Source excerpt

It's very common when working with TypeScript that you will have a type that declares a list of values, such as an enum or union type: enum SupportedColour1 { RED, YELLOW, BLUE, } type SupportedColour2 = 'RED' | 'YELLOW' | 'BLUE' And then you will often have functions that need to run differently or return different values based on what variant is passed in: function codeForColour1(colour: SupportedColour1): string { switch (colour) { case SupportedColour1.BLUE: return '#0000ff' case SupportedColour1.RED: return '#ff0000' case SupportedColour1.YELLOW: return '#ffff00' } } function codeForColour2(colour: SupportedColour2): string { switch (colour) { case 'BLUE': return '#0000ff' case 'RED': return '#ff0000' case 'YELLOW': return '#ffff00' } } Updating code when types change One thing that can catch you out is if the list of valid values in the type changes. Let's say we want to add GREEN as a value to our union type (I will drop the enum example for brevity, but the functionality for the sake of this post is equivalent): type SupportedColour2 = 'RED' | 'YELLOW' | 'BLUE' | 'GREEN' In this case we will now get an error in this function. TypeScript will realise that the function does not return anything in the case that GREEN is passed in, but the error is not very obvious: function codeForColour2(colour: SupportedColour2): string { switch (colour) { case 'BLUE': return '#0000ff' case 'RED': return '#ff0000' case 'YELLOW': return '#ffff00' } } Function lacks ending return statement and return type does not include 'undefined'. If the function did not return a value, TypeScript will not error and it would be easy to miss that we now have a branch (for GREEN) that is not dealt with: // This will not error in TypeScript, even though we are not // dealing with the GREEN case. function logForColour(colour: SupportedColour2): void { switch (colour) { case 'BLUE': console.log('User picked blue') case 'RED': console.log('User picked red') case 'YELLOW': console.log('User picked

## Sealed Types

DevFeed: [Sealed Types](<https://devfeed.tech/articles/sealed-types-25064.md>)

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

Author: author@typealias.com (Dave Leeds)

Published: 2024-01-16T00: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: [sealed interface](<https://devfeed.tech/topics/sealed-interface.md>), [interface](<https://devfeed.tech/topics/interface.md>), [Programming Language Type Systems](<https://devfeed.tech/topics/programming-language-type-systems.md>), [enum](<https://devfeed.tech/topics/enum.md>)

Tags: [classes](<https://devfeed.tech/tags/classes.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enum-class](<https://devfeed.tech/tags/enum-class.md>), [exhaustive](<https://devfeed.tech/tags/exhaustive.md>), [exhaustive-matching](<https://devfeed.tech/tags/exhaustive-matching.md>), [ice-cubes](<https://devfeed.tech/tags/ice-cubes.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [learn-to-program](<https://devfeed.tech/tags/learn-to-program.md>), [programming](<https://devfeed.tech/tags/programming.md>), [sealed](<https://devfeed.tech/tags/sealed.md>), [sealed-class](<https://devfeed.tech/tags/sealed-class.md>), [sealed-interface](<https://devfeed.tech/tags/sealed-interface.md>), [subtype](<https://devfeed.tech/tags/subtype.md>), [types](<https://devfeed.tech/tags/types.md>), [when-conditional](<https://devfeed.tech/tags/when-conditional.md>)

### AI overview

Sealed interfaces and classes let Kotlin limit the possible types in a hierarchy, much as enum classes limit possible values, so Kotlin can check that a when expression accounts for every case. The excerpt introduces Cecil's Ice Shop, where customers request orders or refunds and the owner models the operation in Kotlin; it notes that package sizes are initially represented by an enum class, but does not show the sealed-type implementation.

### Source excerpt

In Chapter 5, we saw how limiting our options can be a good thing. In that chapter, we used enum classes to limit our values, which allows Kotlin to ensure that we account for all possibilities in a when expression. We can get a similar benefit for our types by using sealed interfaces and classes. In this chapter, we'll visit Cecil's Ice Shop to learn all about sealed types. Let's get started!

## What's new in PHP 8.3

DevFeed: [What's new in PHP 8.3](<https://devfeed.tech/articles/what-s-new-in-php-8-3-44176.md>)

Original publisher: [Read original article](<https://stitcher.io/blog/new-in-php-83>)

Author: Brent

Published: 2023-11-23T00:00:00Z

Content type: article

Language: en

Sources: [Stitcher](<https://devfeed.tech/sources/stitcher-io.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [class](<https://devfeed.tech/topics/class.md>), [JSON](<https://devfeed.tech/topics/json.md>), [Randomizer](<https://devfeed.tech/topics/randomizer.md>), [enum](<https://devfeed.tech/topics/enum.md>)

Tags: [2023](<https://devfeed.tech/tags/2023.md>), [arrays](<https://devfeed.tech/tags/arrays.md>), [classes](<https://devfeed.tech/tags/classes.md>), [enum](<https://devfeed.tech/tags/enum.md>), [json](<https://devfeed.tech/tags/json.md>), [memory](<https://devfeed.tech/tags/memory.md>), [performance](<https://devfeed.tech/tags/performance.md>), [php](<https://devfeed.tech/tags/php.md>), [update](<https://devfeed.tech/tags/update.md>), [what-s-new](<https://devfeed.tech/tags/what-s-new.md>)

### AI overview

A feature-by-feature overview of PHP 8.3, covering readonly class updates, typed class constants, the #[\Override] attribute, negative array indices, anonymous readonly classes, JSON validation, and additions to the Randomizer API.

### Source excerpt

Read the full post on https://stitcher.io/blog/new-in-php-83

## Implementing Enumerations In Go

DevFeed: [Implementing Enumerations In Go](<https://devfeed.tech/articles/implementing-enumerations-in-go-22228.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/09/implementing-enumerations-in-golang.html>)

Published: 2023-09-21T00:00:00Z

Content type: tutorial

Language: en

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

Topics: [enum](<https://devfeed.tech/topics/enum.md>), [typesafety](<https://devfeed.tech/topics/typesafety.md>), [data type](<https://devfeed.tech/topics/data-type.md>)

Tags: [compiler](<https://devfeed.tech/tags/compiler.md>), [enumeration](<https://devfeed.tech/tags/enumeration.md>), [go](<https://devfeed.tech/tags/go.md>), [golang](<https://devfeed.tech/tags/golang.md>), [roles](<https://devfeed.tech/tags/roles.md>), [string](<https://devfeed.tech/tags/string.md>), [struct](<https://devfeed.tech/tags/struct.md>), [type-safety](<https://devfeed.tech/tags/type-safety.md>), [variables](<https://devfeed.tech/tags/variables.md>)

### AI overview

The author proposes using a struct with an unexported string field to model enumerated values in Go. Unlike a string-based defined type, this struct prevents arbitrary matching strings from being implicitly passed as valid roles, providing compiler protection. The author uses variables rather than constants for the defined role values because Go constants are limited to numeric, string, or boolean types. String values are preferred for roles passed through web requests because the author finds them more readable and less confusing than integers; the excerpt says the approach could also use integers. The author describes the pattern as close to C# enums but imperfect. The supplied excerpt ends before explaining its limitations or full implementation.

### Source excerpt

Introduction Prior to coding in Go, I was writing software in C#. In C# enumerations can be declared and the associated type can be used in functions and as fields in a struct. The compiler won't allow a value of the enumerated type to be passed or set that doesn't belong to the defined set. This is something that I have missed since coding in Go. Go doesn't have enumerations and it can be a problem at times when you want type safety for a well-defined set of values. A common way people try to have enumerations in Go really doesn't work for me because of the way constants behave. That being said, I have developed a pattern that gets me as close as possible to what I had in C# though it's not perfect and I will explain.

## Interfaces 101 : Go's Logging Interface Ep. 4

DevFeed: [Interfaces 101 : Go's Logging Interface Ep. 4](<https://devfeed.tech/articles/interfaces-101-go-s-logging-interface-ep-4-22214.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/02/interfaces-101-go-logging-interface.html>)

Published: 2023-02-21T00:00:00Z

Content type: tutorial

Language: en

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

Topics: [interface](<https://devfeed.tech/topics/interface.md>), [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>), [enum](<https://devfeed.tech/topics/enum.md>), [data type](<https://devfeed.tech/topics/data-type.md>)

Tags: [enumerators](<https://devfeed.tech/tags/enumerators.md>), [formatting](<https://devfeed.tech/tags/formatting.md>), [go](<https://devfeed.tech/tags/go.md>), [golang](<https://devfeed.tech/tags/golang.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [log-interface](<https://devfeed.tech/tags/log-interface.md>), [pretty-printing](<https://devfeed.tech/tags/pretty-printing.md>), [server-logs](<https://devfeed.tech/tags/server-logs.md>), [type](<https://devfeed.tech/tags/type.md>)

### AI overview

The video demonstrates how to control the printed representation of a Go type by implementing Go's formatting interface. Miki defines a user-defined enumerated type for keys, then adds the required method to determine how its values are formatted as strings. The excerpt also links this to an earlier example: returning a nil pointer as a concrete custom error type can produce a non-nil error interface, illustrating why the variable's interface type matters.

### Source excerpt

Introduction In episode 3, Miki implemented a type that satisfied Go's error interface. The odd thing about his type was it would be considered not-nil although no value was set for it. To get a better understanding of the situation, Miki gives a brief explanation of how Go determines if an error value is nil, and in this case, Miki specified the type of the variable returned to be a pointer of his custom error type which blindsided Go's mechanism to determine a nil value. Miki chose this example because it demonstrated the importance of declaring an error with its type set as the error interface.

## Enum classes in Kotlin

DevFeed: [Enum classes in Kotlin](<https://devfeed.tech/articles/enum-classes-in-kotlin-39330.md>)

Original publisher: [Read original article](<https://kt.academy/article/kfde-enum>)

Published: 2023-02-01T00:01:00Z

Content type: tutorial

Language: en

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

Topics: [enum](<https://devfeed.tech/topics/enum.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>)

Tags: [abstract-class](<https://devfeed.tech/tags/abstract-class.md>), [class](<https://devfeed.tech/tags/class.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enum-class](<https://devfeed.tech/tags/enum-class.md>), [enums](<https://devfeed.tech/tags/enums.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [property](<https://devfeed.tech/tags/property.md>), [superclass](<https://devfeed.tech/tags/superclass.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This Kotlin tutorial explains how to define and use enum classes to represent finite sets of values. It covers enum values and their order, companion object utilities, exhaustive when conditions, stored state, and custom methods.

### Source excerpt

What are enum classes in Kotlin and how do we use them.

## PHP 8.2 in 8 code blocks

DevFeed: [PHP 8.2 in 8 code blocks](<https://devfeed.tech/articles/php-8-2-in-8-code-blocks-44211.md>)

Original publisher: [Read original article](<https://stitcher.io/blog/php-82-in-8-code-blocks>)

Author: Brent

Published: 2022-10-24T00:00:00Z

Content type: article

Language: en

Sources: [Stitcher](<https://devfeed.tech/sources/stitcher-io.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [Code](<https://devfeed.tech/topics/code.md>), [deprecated](<https://devfeed.tech/topics/deprecated.md>), [enum](<https://devfeed.tech/topics/enum.md>), [properties](<https://devfeed.tech/topics/properties.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [deprecated](<https://devfeed.tech/tags/deprecated.md>), [enum](<https://devfeed.tech/tags/enum.md>), [php](<https://devfeed.tech/tags/php.md>), [properties](<https://devfeed.tech/tags/properties.md>), [types](<https://devfeed.tech/tags/types.md>)

### AI overview

An overview of PHP 8.2 features presented through eight code blocks, including the random extension, disjunctive normal form types, constants in traits, redacted parameters, deprecated dynamic properties, enum properties in constant expressions, and related language changes.

### Source excerpt

Read the full post on https://stitcher.io/blog/php-82-in-8-code-blocks

## My PHP enum style guide

DevFeed: [My PHP enum style guide](<https://devfeed.tech/articles/my-php-enum-style-guide-44218.md>)

Original publisher: [Read original article](<https://stitcher.io/blog/php-enum-style-guide>)

Author: Brent

Published: 2022-05-30T00:00:00Z

Content type: tutorial

Language: en

Sources: [Stitcher](<https://devfeed.tech/sources/stitcher-io.md>)

Topics: [enum](<https://devfeed.tech/topics/enum.md>), [PHP](<https://devfeed.tech/topics/php.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [enum](<https://devfeed.tech/tags/enum.md>), [guide](<https://devfeed.tech/tags/guide.md>), [php](<https://devfeed.tech/tags/php.md>), [style-guide](<https://devfeed.tech/tags/style-guide.md>)

### AI overview

A personal PHP enum style guide recommends uppercase enum cases, avoiding backed enums unless serialization or scalar-value construction is needed, and keeping enum methods simple. It explains the author's reasoning around naming conventions, maintenance overhead, and practical use cases.

### Source excerpt

Read the full post on https://stitcher.io/blog/php-enum-style-guide

## Unconfined Enums Adapter for Moshi

DevFeed: [Unconfined Enums Adapter for Moshi](<https://devfeed.tech/articles/unconfined-enums-adapter-for-moshi-25914.md>)

Original publisher: [Read original article](<https://medium.com/@xxfast/unconfined-enums-adapter-for-moshi-5d84542c8bf0?source=rss-43bae76e8f81------2>)

Author: Isuru Rajapakse

Published: 2022-05-11T12:08:49Z

Content type: article

Language: en

Sources: [Isuru Rajapakse](<https://devfeed.tech/sources/stories-by-isuru-rajapakse-on-medium.md>)

Topics: [enum](<https://devfeed.tech/topics/enum.md>), [adapter pattern](<https://devfeed.tech/topics/adapter-pattern.md>), [interface](<https://devfeed.tech/topics/interface.md>)

Tags: [adapter](<https://devfeed.tech/tags/adapter.md>), [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [converter](<https://devfeed.tech/tags/converter.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enums](<https://devfeed.tech/tags/enums.md>), [interface](<https://devfeed.tech/tags/interface.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [mapping](<https://devfeed.tech/tags/mapping.md>), [moshi](<https://devfeed.tech/tags/moshi.md>), [need](<https://devfeed.tech/tags/need.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>)

### AI overview

The excerpt proposes replacing a finite Kotlin enum with an interface and an Unknown data class that retains an unrecognized API value, so Moshi can preserve values such as "Bananas" instead of throwing a JsonDataException or mapping them all to a fixed fallback. This makes the original server value available to application code, but an unrecognized value no longer has the enum's localized string-resource mapping. The excerpt cuts off before showing the complete adapter implementation.

### Source excerpt

If you wonder what an Unconfined Enum is, wonder no more because it is a thing I just made up. Enums by definition are confined, or finite. Therefore "unconfined enum" is really an oxymoron. Nevertheless, say you have this Fruit enum and want to map each value to an Android string resource. Kotlin's enum properties make this convenient enum class Fruit(@StringRes val stringRes: Int) { Apple(R.string.fruit_apple), Oranges(R.string.fruit_orange) } When we want to consume this enum from a Restful API with a Moshi converter, Moshi automatically generates the enum adapter for you, but if you want to customise the behaviour for whatever reason, you can do object FruitsAdapter { @ToJson fun toJson(type: Fruit): String = type.name @FromJson fun fromJson(name: String): Fruit = Fruit.values().first { it.name == name } } Happy days. Everything is working as expected. When things go bananascom.squareup.moshi.JsonDataException: Expected one of [Apple, Oranges] but was Bananas at path $ Good APIs don't break contracts. Not all APIs are good APIs, so some can break contracts. What do we do now? push out an update with added enum value and its string resource? Perhaps we can make use of EnumJsonAdapter's .withUnknownFallBack() enum class Fruit(@StringRes val stringRes: Int) { Apple(R.string.fruit_apple), Oranges(R.string.fruit_orange), Unknown(R.string.fruit_unknown) } Moshi.Builder() .add(KotlinJsonAdapterFactory()) .add(Fruit::class.java, EnumJsonAdapter.create(Fruit::class.java) .withUnknownFallback(Fruit.Unknown)) .build() This certainly stops the app from crashing, but what if we actually want to show the "bananas" that the API sends? you know, as a fail safe so that users wouldn't end up seeing "unknowns". Let's open up the Enums Enums are by definition finite. Enums are final by design. Enums can't be subclassed but they still can inherit interfaces. We will exploit this to create our "unconfined" enum interface Fruit { val name: String data class Unknown(override val name:

## PHP in 2021 (video)

DevFeed: [PHP in 2021 (video)](<https://devfeed.tech/articles/php-in-2021-video-44225.md>)

Original publisher: [Read original article](<https://stitcher.io/blog/php-in-2021-video>)

Author: Brent

Published: 2022-01-24T00:00:00Z

Content type: article

Language: en

Sources: [Stitcher](<https://devfeed.tech/sources/stitcher-io.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Package Management](<https://devfeed.tech/topics/package-management.md>), [async](<https://devfeed.tech/topics/async.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [JIT](<https://devfeed.tech/topics/jit.md>), [enum](<https://devfeed.tech/topics/enum.md>), [Framework](<https://devfeed.tech/topics/framework.md>), [Laravel](<https://devfeed.tech/topics/laravel.md>), [Symfony](<https://devfeed.tech/topics/symfony.md>)

Tags: [2021](<https://devfeed.tech/tags/2021.md>), [async](<https://devfeed.tech/tags/async.md>), [developers](<https://devfeed.tech/tags/developers.md>), [enums](<https://devfeed.tech/tags/enums.md>), [frameworks](<https://devfeed.tech/tags/frameworks.md>), [jetbrains](<https://devfeed.tech/tags/jetbrains.md>), [jit](<https://devfeed.tech/tags/jit.md>), [laravel](<https://devfeed.tech/tags/laravel.md>), [php](<https://devfeed.tech/tags/php.md>), [programming](<https://devfeed.tech/tags/programming.md>), [video](<https://devfeed.tech/tags/video.md>)

### AI overview

A video and transcript review PHP's continued development and ecosystem in 2021. It covers recent language features, growing static analysis adoption, the PHP Foundation, package downloads, popular frameworks and CMSs, and asynchronous PHP runtimes.

### Source excerpt

Read the full post on https://stitcher.io/blog/php-in-2021-video

## PHP in 2022

DevFeed: [PHP in 2022](<https://devfeed.tech/articles/php-in-2022-44226.md>)

Original publisher: [Read original article](<https://stitcher.io/blog/php-in-2022>)

Author: Brent

Published: 2022-01-11T00:00:00Z

Content type: article

Language: en

Sources: [Stitcher](<https://devfeed.tech/sources/stitcher-io.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [ide](<https://devfeed.tech/topics/ide.md>), [phpstorm](<https://devfeed.tech/topics/phpstorm.md>), [enum](<https://devfeed.tech/topics/enum.md>), [generic programming](<https://devfeed.tech/topics/generic-programming.md>), [Laravel](<https://devfeed.tech/topics/laravel.md>), [syntax](<https://devfeed.tech/topics/syntax.md>)

Tags: [2021](<https://devfeed.tech/tags/2021.md>), [blog](<https://devfeed.tech/tags/blog.md>), [code](<https://devfeed.tech/tags/code.md>), [enums](<https://devfeed.tech/tags/enums.md>), [generics](<https://devfeed.tech/tags/generics.md>), [laravel](<https://devfeed.tech/tags/laravel.md>), [php](<https://devfeed.tech/tags/php.md>), [php-8-1](<https://devfeed.tech/tags/php-8-1.md>), [phpstorm](<https://devfeed.tech/tags/phpstorm.md>)

### AI overview

A 2022 overview of modern PHP, covering PHP 8.1 features such as enums, readonly properties, and improved syntax, along with growing static-analysis support in Laravel and PhpStorm generics support.

### Source excerpt

Read the full post on https://stitcher.io/blog/php-in-2022

## What's new in PHP 8.1

DevFeed: [What's new in PHP 8.1](<https://devfeed.tech/articles/what-s-new-in-php-8-1-44174.md>)

Original publisher: [Read original article](<https://stitcher.io/blog/new-in-php-81>)

Author: Brent

Published: 2021-11-25T00:00:00Z

Content type: article

Language: en

Sources: [Stitcher](<https://devfeed.tech/sources/stitcher-io.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [enum](<https://devfeed.tech/topics/enum.md>), [Code](<https://devfeed.tech/topics/code.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Parallelism](<https://devfeed.tech/topics/parallelism.md>), [properties](<https://devfeed.tech/topics/properties.md>), [Closure](<https://devfeed.tech/topics/closure.md>), [Inheritance](<https://devfeed.tech/topics/inheritance.md>), [Parameter](<https://devfeed.tech/topics/parameter.md>), [syntax](<https://devfeed.tech/topics/syntax.md>)

Tags: [blog](<https://devfeed.tech/tags/blog.md>), [closure](<https://devfeed.tech/tags/closure.md>), [code](<https://devfeed.tech/tags/code.md>), [enums](<https://devfeed.tech/tags/enums.md>), [inheritance](<https://devfeed.tech/tags/inheritance.md>), [parallelism](<https://devfeed.tech/tags/parallelism.md>), [parameter](<https://devfeed.tech/tags/parameter.md>), [php](<https://devfeed.tech/tags/php.md>), [php-8-1](<https://devfeed.tech/tags/php-8-1.md>), [post](<https://devfeed.tech/tags/post.md>), [properties](<https://devfeed.tech/tags/properties.md>), [what-s-new](<https://devfeed.tech/tags/what-s-new.md>)

### AI overview

An overview of the new features, performance improvements, changes, and deprecations introduced in PHP 8.1, including enums, fibers, inheritance caching, string-key array unpacking, readonly properties, first-class callable syntax, and intersection types.

### Source excerpt

Read the full post on https://stitcher.io/blog/new-in-php-81

## How to implement Swift-friendly API with Kotlin Multiplatform Mobile

DevFeed: [How to implement Swift-friendly API with Kotlin Multiplatform Mobile](<https://devfeed.tech/articles/how-to-implement-swift-friendly-api-with-kotlin-multiplatform-mobile-23904.md>)

Original publisher: [Read original article](<https://medium.com/icerock/how-to-implement-swift-friendly-api-with-kotlin-multiplatform-mobile-e68521a63b6d?source=rss----b74ae24564e---4>)

Author: Aleksey Mikhailov

Published: 2021-08-07T16:49:33Z

Content type: tutorial

Language: en

Sources: [IceRock Development](<https://devfeed.tech/sources/icerock-development-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Swift](<https://devfeed.tech/topics/swift.md>), [Mobile](<https://devfeed.tech/topics/mobile.md>), [enum](<https://devfeed.tech/topics/enum.md>), [Code](<https://devfeed.tech/topics/code.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>)

Tags: [compiler](<https://devfeed.tech/tags/compiler.md>), [enum](<https://devfeed.tech/tags/enum.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlin-multiplatform-mobile](<https://devfeed.tech/tags/kotlin-multiplatform-mobile.md>), [kotlin-native](<https://devfeed.tech/tags/kotlin-native.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [sealed-interface](<https://devfeed.tech/tags/sealed-interface.md>), [swift](<https://devfeed.tech/tags/swift.md>)

### AI overview

This tutorial explains how Kotlin Multiplatform Mobile exposes Kotlin APIs to Swift through generated Objective-C APIs. It demonstrates usability issues with sealed interfaces at the Kotlin-Swift boundary and introduces IceRock's MOKO KSwift Gradle plugin, which analyzes Kotlin/Native library metadata to generate a more convenient Swift API.

### Source excerpt

Kotlin Multiplatform Mobile allows you to compile Kotlin code into native libraries for Android and iOS. If in the case of Android the library obtained from Kotlin will be integrated with an application written in Kotlin, then for iOS the integration will be with Swift. There is a loss of usability at the junction of Kotlin and Swift, due to the difference in languages. This is mainly because the Kotlin/Native compiler (which compiles Kotlin in the iOS framework and is part of the Kotlin Multiplatform) generates the public API of the framework in ObjectiveC. We access Kotlin from Swift through this generated ObjectiveC API, since Swift interacts with ObjectiveC. Further, I will show examples of API waste at the Kotlin-Swift junction and a tool that allows you to get a more convenient API for usage from Swift. Let's look at the example of using a sealed interface in Kotlin: sealed interface UIState<out T> { object Loading : UIState<Nothing> object Empty : UIState<Nothing> data class Data<T>(val value: T) : UIState<T> data class Error(val throwable: Throwable) : UIState<Nothing> } This is a convenient construct to describe states, which is actively used in the Kotlin code. Let's see how it looks from the Swift side. public protocol UIState { }public class UIStateLoading : KotlinBase, UIState { }public class UIStateEmpty : KotlinBase, UIState { }public class UIStateData<T> : KotlinBase, UIState where T : AnyObject { open var value: T? { get } }public class UIStateError : KotlinBase, UIState { open var throwable: KotlinThrowable { get } } From the Swift side Kotlin's sealed interface looks like a set of classes with a common protocol. Of course, in this case, one cannot hope to check the completeness of the switch implementation, since it is not an enum. For developers familiar with Swift, the enum is considered a more correct analog of the sealed interface, for example: enum UIState<T> { case loading case empty case data(T) case error(Error) } We can write such an enum

## PHP 8.1: before and after

DevFeed: [PHP 8.1: before and after](<https://devfeed.tech/articles/php-8-1-before-and-after-44205.md>)

Original publisher: [Read original article](<https://stitcher.io/blog/php-81-before-and-after>)

Author: Brent

Published: 2021-07-16T00:00:00Z

Content type: article

Language: en

Sources: [Stitcher](<https://devfeed.tech/sources/stitcher-io.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Code](<https://devfeed.tech/topics/code.md>), [enum](<https://devfeed.tech/topics/enum.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [enums](<https://devfeed.tech/tags/enums.md>), [php](<https://devfeed.tech/tags/php.md>), [php-8-1](<https://devfeed.tech/tags/php-8-1.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

An overview of the practical impact of PHP 8.1, focusing on enums, string-key array unpacking, class property initializers, readonly properties, and first-class callable syntax. The author explains how these features simplify existing PHP code.

### Source excerpt

Read the full post on https://stitcher.io/blog/php-81-before-and-after

[Next page](<https://devfeed.tech/topics/enum.md?cursor=WyIyMDIxLTA3LTE2VDAwOjAwOjAwKzAwOjAwIiwgIjliYzk1MDNmLWYwMzktNDc3OS1iNjY3LTVhY2RkYjcxNDc3OCJd>)