While I get your point, there's also the common use case of logging messages; that is, I usually include the app name in case someone decides to log everything to the same log. There's also message displayed to the end user. I mean I usually put something in the message about exactly which app it is in case the end-user decides to capture a screen shot or something like that. For whatever it's worth, having a standardized variable like __APP__ would help with those use cases and make it a little easier to maintain.
oc On Wednesday, November 30, 2016 at 4:34:06 PM UTC-5, Michał Muskała wrote: > > How often one needs to rename the application? I had to do this only once, > and it was a simple find & replace. > > While __APP__ would simplify it, I find it a bit ugly to have every module > defined like this. And if there was an __APP__ variable, I would certainly > expect it to be the OTP application name, not some mutated module name. As > of now there's no place in mix.exs that defines the "base" module for an > application, and it's nor reliable to inflect it automatically from the OTP > application name, some examples: > > mongodb uses Mongo, mongodb_ecto uses Mongo.Ecto, phoenix_html uses > Phpenix.HTML, phoenix_pubsub uses Phoenix.PubSub, cors_plug uses CORSPlug, > plug_cors uses PlugCors. > > I don't see a way how we can inflect those automatically. > > Michał. > > > On 30 Nov 2016, at 17:40, Dave Thomas <[email protected] <javascript:>> > wrote: > > > > I just tried to change the application name in a trivial Phoenix > project. The name of the project is embedded into the source code 48 times. > I have one controller, one view, and a channel. > > > > My suggestion: assume anything created using mix will be build using > mix. For these builds, add the definition __APP__, set to the application > name (in module-name form) from the mix.exs file. > > > > Then generate all the underlying files using > > > > defmodule __APP__.EndPoint do > > > > ... > > > > This could apply to both mix new and mix phoenix.new, as well as > anything else that comes along. > > > > Dave > > > > > > -- > > You received this message because you are subscribed to the Google > Groups "elixir-lang-core" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/fe291b67-82f9-411e-ae3a-a1821867ebc6%40googlegroups.com. > > > > For more options, visit https://groups.google.com/d/optout. > > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/34a3933f-9f06-48a8-bf75-d6991bf6d097%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
