v_melnik has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

Would you be so kind as to share your wisdom on the following question which doesn't let me sleep well for the last few hours:

How would you spell the package name for some instance that is being called maitre d'hotel?

String::CamelCase::camelize("maitre_d'hotel") translates it as MaitreD'Hotel, but using an apostrophe seems to be a pretty risky way. :-)

I have a couple of controversal optinions after some time of googling, so I'd be very grateful for any suggestions from you.

Loads of thanks to all of you in advance!

V.Melnik

P.S. I'd prefer to stick with one of these options: MaitreDHotel and MaitredHotel, and MaitreDeHotel. What would you choose?

P.P.S. Couldn't resist to xpost it to StackOverflow, but it doesn't seem to be appropriate there, so maybe it will be removed by me or by the moderating team :)

Replies are listed 'Best First'.
Re: Camelizing a maitre d'Hotel
by LanX (Saint) on Feb 03, 2017 at 13:53 UTC
    No apostrophe!!!

    Replace it with an underscore or drop it: like Maitre_D_Hotel or MaitreDHotel

    Background is that Perl still supports (the very old) syntax of apostrophe for doublecolon

    That is a use MaitreD'Hotel would be treated like use MaitreD::Hotel

    update

    compare Acme::Don't

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      Yes, sure, apostrophe wouldn't be appropriate here.

      But how to call it? Maitre::DHotel, Maitre::Dhotel, MaitreD::Hotel, Maitred::Hotel, Maitre::D::Hotel (uh, actually it was kind of sarcasm, I don't need to separate this namespace by 2 parts)

      V.Melnik
        > Maitre::DHotel, Maitre::Dhotel, MaitreD::Hotel, Maitred::Hotel, Maitre::D::Hotel , oh damn it... :)

        There is no Maitre namespace on CPAN yet.

        Unless you plan to release Maitre::Maison or Maitre::Bordel later, I'd stick with MaitreDHotel.

        see also PadWalker

        ===Update

        But if you insist on creating a new namespace drop the D since the :: could be seen as preposition.

        Maitre::Hotel

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

        UPDATE: typo corected! thanks GotToBTru++

Re: Camelizing a maitre d'Hotel
by morgon (Priest) on Feb 03, 2017 at 15:21 UTC
    d+apostrophe is short for "de", so why not use that?

    I'd use "MaitreDeHotel".

      I'd use "MaitreDeHotel".
      Please, no, it looks to me as a mistake by someone not knowing the French language. Maitre_d_hotel or Maitre_D_Hotel seem much better to me.
        It means hotel manager, since you asked.
Re: Camelizing a maitre d'Hotel
by Anonymous Monk on Feb 03, 2017 at 20:11 UTC
    How would you spell the package name for some instance that is being called maitre d'hotel?

    Answer. You would not. That is role, not a class. The role is Manager and the class assigned to that role belongs to a Hotel class. If you organize intelligently, such questions are rendered MOOT. :)