Blog

mstring.fedem.eu is live

Posted on 2026-09-26

mstring has its own site starting today, at mstring.fedem.eu — the sixth in the family after cparse, callonce, fson and plugin.

What mstring is

A code generator for the messages of C++ programs and libraries. You write each message once — its typed parameters and its text in every language:

$MODULE errors
$LANGUAGE en
$EXCEPTION INHERITED std::exception
$THROW ENABLE

$MESSAGE ConfigMissing
@ path std::string const &
"configuration file '{$path}' is missing"
[tr]
"yapılandırma dosyası '{$path}' bulunamadı"

and mstring writes the C++:

try
{
  ThrowConfigMissing( "/etc/app.conf" );
}
catch ( std::exception const &e )
{
  std::cerr << e.what( ) << '\n';   // configuration file '/etc/app.conf' is missing
}

A string function, a streamable class, an exception class and its throw function, a fatal-error function, a syslog function — from the same message, in the language of the locale you give it. ThrowConfigMissing( 42 ) does not compile.

Why a generator

Run-time catalogs (gettext, ICU) look a text up by a key and format untyped arguments. For an application's user interface, translated by a team and updated without a release, that is the right design. For the messages of a library — its errors, its exceptions, its log lines — it is more machinery than the job needs, and a typo in an argument list shows up as a garbled message in production. mstring moves that to compile time.

What is on the site

mstring is MIT-licensed.