That’s an incredibly off-base analogy. An e-mail address isn’t a payment form and receiving spam from a company that for no reason wants your e-mail isn’t the same as trading money for a product. I’m sorry if I offended anyone who uses this mildly dark pattern and wants to rationalize it, but you’re definitely moving towards user hostility in doing so, unless you can prove value to your users and show that value as an imperative to using a real e-mail address.
The lookup process seems a bit inefficient, I would pattern match on function heads instead.
for bad_domain <- File.stream!("bad_domains") do
def lookup(unquote(bad_domain)), do: "EmailGuard.BadDomainList"
end
def lookup(_unmatched), do: nil
def check(email) do
domain = extract_domain(email)
if resp = lookup(domain) do
{:error, resp}
else
:ok
end
end
I know it is an off-base analogy (hence the tongue emoji in the end), but it serves the purpose to demonstrate one thing: it’s up to businesses to decide what’s the best way to provide their goods/service, and up to customers/users to decide whether or not to accept those terms.
I disagree with your generalisation that companies need your email only to spam you, and that it is a “mildly dark pattern” (whatever that means in this context), but I will stop here since this is not the topic of the thread.
I was indeed worried about performance, but I’m not actually using files — all domains are inlined and compiled with the module. Could you maybe open a PR with a proof-of-concept?