Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 18.104.22.168 release ready!
Updated 29 November 2019
A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains. Some examples of using DSLs (SQL, RegExp, Gradle).
What need we know to start DSL?
3.Lambdas With Receivers
1.Lamda expression :
Lambda expression is a short way to define a function. A function without a name is called the anonymous function. Lambdas Expressions are anonymous functions that we can pass them as arguments to methods or return.
Lambda Expressions look like below:
A higher-order function is a function that can take other functions as parameters and returns other functions.
Now Let’s start by converting a data model class into DSL
Now let’s make the DSL higher-order function:
Finally, we have created our data model object in the DSL way.
It’s worked fine, but you need to use it to access the properties instead of accessing them directly. We can fix it with the help of lambdas with receivers.
We will come back soon with part 2 lambdas with receivers
I hope this blog is useful to you. Thanks for reading.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.