preprocessing printf/regex strings (like ocaml)

Dylan Thurston dpt@math.harvard.edu
Tue, 14 May 2002 11:12:43 -0400


--jRHKVT23PllUwdXP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, May 14, 2002 at 03:45:36PM +0100, Robert Ennals wrote:
> Just thought I would jump in and say that, unlike (it seems)
> everyone else, I hate printf in C. It is a horrible horrible
> inextensible hack of a function that I find extremely awkward to
> use.
> ...
> I personally much prefer the syntax currently used in Haskell, which
> is also essentially what is used in most other recent languages,
> including Java, C++, and (god help me) Perl.
> =20
> In the example given, I could write:
>=20
> "I have " ++ action ++ " " ++ number ++ " " ++ whatas
> where
>     action =3D "trained"
>     number =3D show 1
>     whatas =3D "Jedi"
>=20
> Which is IMHO rather more readable than a load of weird control codes hid=
den=20
> in a text string that one then has to match against a list.

How would you deal with internationalisation issues?

--Dylan
--jRHKVT23PllUwdXP
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE84SlqVeybfhaa3tcRAoasAKCDANZX05dRr5REpbKZkQ9Xi3FJuQCfc8rA
NoXVRkG/W/LwJ7JjrVHNPZc=
=r/Nx
-----END PGP SIGNATURE-----

--jRHKVT23PllUwdXP--