News for hackers. Stuff that matters.
Re:Hanami 2.0 (Ruby): Better, Faster, Stronger by revskill on Tuesday November 22, 2022 @10:05AM (#33706553)
def call(name:, email_address:) email_client.deliver( to: email_address, subject: "Welcome!", text_body: welcome_email.render_text(name: name), html_body: welcome_email.render_html(name: name) )

        SlackNotifier.notify("Welcome email sent to #{email_address}")
      end
This code is bad.

If you want Hanami to be an IoC framework, why still allow direct SlackNotifier to be injected to the action layer here ? I guess, lib/ folder should be loaded into Deps instead (Deps["slack_notifier"] ?

Re:Hanami 2.0 (Ruby): Better, Faster, Stronger by solnic on Tuesday November 22, 2022 @01:45PM (#33709395)
You missed the context of this example - it's just there to show that IF you don't want to use constructor DI, you can put things in lib and they won't become part of the automatic DI system
Re:Hanami 2.0 (Ruby): Better, Faster, Stronger by revskill on Tuesday November 22, 2022 @01:56PM (#33709554)
The point here, is, let's code in production.

No good production code allows such things to accidentially happen, so to me, it's the error from framework. What's the point of using a framework if it couldn't help me do silly things then ?

Re:Hanami 2.0 (Ruby): Better, Faster, Stronger by lukeasrodgers on Tuesday November 22, 2022 @08:47PM (#33714075)
How would Hanami prevent this without messing with ruby constant lookup? Probably monkey patches to Kernel would be required.