Link Details

Link 586241 thumbnail
User 744963 avatar

By inphina
via wp.me
Published: Apr 14 2011 / 12:26

DSL (Domain Specific Language) is a programming language or specification language dedicated to a particular problem domain, problem representation or a particular solution technique. So with a few Scala Nuggets on our way we are ready to write a DSL? Not quite but in this post we would touch upon a critical feature in Scala which makes writing DSL’s easy. Let us look at the following code snippet. view sourceprint? 1 println (1+2) 2 println (1 .+(2)) 3 println (1.+(2)) 4 println (1 +(2))
  • 7
  • 0
  • 2045
  • 1

Comments

Add your comment
User 265013 avatar

darkfrog replied ago:

0 votes Vote down Vote up Reply

The last example could be much more elegantly be written:

def switchOnACat(n:Int) = n > 35

User 744963 avatar

Inphina Technologies replied ago:

0 votes Vote down Vote up Reply

Excellent point darkfrog. Totally agreed, I would cross post this on the blog as well.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (7)



Voters Against This Link (0)



    Java EE7
    Written by: Andrew Lee Rubinger
    Featured Refcardz: Top Refcardz:
    1. Design Patterns
    2. OO JS
    3. Cont. Delivery
    4. CI Patterns
    5. CI Tools
    1. Spring Integration
    2. Git
    3. Regex
    4. Java
    5. REST