My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
Yadukrishnan

1 like

·

602 reads

2 comments

Nick F
Nick F
Sep 9, 2022

Self Type as Dependency

Have you used this in the wild? It seems interesting, but not sure when I would use it. Perhaps if I don't control the Vehicle trait, but I want to extend it? But Scala has Extension Methods to do this as well. When should I use one or the other? I haven't had to use Extension Methods either. Perhaps this is more for building Libraries and not Applications?

Self Type as Tagging

This remind me a lot of var that = this; in JavaScript haha, brings me back. :-)

·
·1 reply
Yadukrishnan
Yadukrishnan
Author
·Sep 16, 2022

Hey Nick F, Self Type as a dependency is widely used in Scala libraries. Overusing it can make it a pain. This is how "cake pattern" is implemented.

·