Thanks for your comment. But I disagree with you. Typealias is useful when it shortens some specific complex and long definitions. It makes code readable. But it is not a type and, it does not define any scope.

If you define a function as you mentioned, I can call the function from any string instance and from anywhere. It causes the function to become context-free.

Writing utility class for email validation groups validation related functions very well. Yes, I wrote the example, I know. But, it is wrong in terms of classification. Kotlin is a Type-Safe language. Thus we should take advantage of type definitions. I suggest you take a look at the "Primitive Obsession" topic.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Responses (1)

Write a response