http://www.perlmonks.org?node_id=935089


in reply to Re: Sensible ordering of 'use' (if any)
in thread Sensible ordering of 'use' (if any)

use strict and warnings first. 'use utf8' is a bug. The rest doesn't matter.
  • Comment on Re^2: Sensible ordering of 'use' (if any)

Replies are listed 'Best First'.
Re^3: Sensible ordering of 'use' (if any)
by anneli (Pilgrim) on Nov 01, 2011 at 11:09 UTC

    use utf8 is a bug? These source files happen to contain a lot of non-ASCII, but maybe I'm misunderstanding you...

      Putting non-ASCII characters in your code is a bug. Therefore 'use utf8' is a bug. Any locale-specific text should be in separate resource files, so that:

      • non-programmers can more easily edit them to, eg, correct your mis-spellings in other languages;
      • programmers are not restricted to using utf-8-capable devices for fixing bugs in an emergency

      I now predict that the usual crowd of idiots will crawl out of the woodwork and say "but any modern machine will Just Work". I invite those people to buy and configure a new laptop for everyone who will have to maintain your code. Right now I'm typing on a machine whose OS was installed less than a year ago. It has problems with properly displaying Funny Foreign Characters.

        Are comments "locale-specific text"?

        The reality is, this code will only be used by me, or my friends (with whom I share a language), and so I don't mind putting my logging messages in my (our) preferred language. Furthermore, the code itself does some natural language processing, again not in English, so it's stupid to have the source in ASCII when I'm making remarks in logs elsewhere about particular codepoints but omit the codepoints themselves to keep it ASCII?

        I'm not going to go to the effort of making a resource file just so I can put my debugging messages in there (half of which get removed after I'm done working on a feature, mind you, but without use utf8 I still couldn't put them in even temporarily), then put in the effort to translate them into pure-ASCII English (so transliteration is often not viable) for the code.

        Putting non-ASCII characters in your code is a bug.

        No, it's not.

        Therefore 'use utf8' is a bug.

        It isn't.

        you should get out more.